diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2019-11-22 06:20:16 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2019-11-22 06:20:16 +0000 |
commit | 4318702add378938f491265d7d1eafb27eedecd0 (patch) | |
tree | 852f7dd045a63081686782b9d480cad10bdd1f08 | |
parent | dae55b315dba0f9dfae2859f628284c3f525fdce (diff) |
Add rtm_proposal, a function to send out RTM_PROPOSAL messages from the
kernel. Will be used to have umb(4) inform unwind(8) about DNS changes.
OK bluhm@ tested by florian@ and deraadt@
-rw-r--r-- | sys/net/route.h | 12 | ||||
-rw-r--r-- | sys/net/rtsock.c | 26 |
2 files changed, 35 insertions, 3 deletions
diff --git a/sys/net/route.h b/sys/net/route.h index d3dcd851f79..090d0cd8baf 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -1,4 +1,4 @@ -/* $OpenBSD: route.h,v 1.178 2019/11/09 17:16:39 florian Exp $ */ +/* $OpenBSD: route.h,v 1.179 2019/11/22 06:20:15 claudio Exp $ */ /* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */ /* @@ -165,7 +165,8 @@ struct rtentry { #define RTP_PROPOSAL_STATIC 57 #define RTP_PROPOSAL_DHCLIENT 58 #define RTP_PROPOSAL_SLAAC 59 -#define RTP_PROPOSAL_SOLICIT 60 /* request reply of all RTM_PROPOSAL */ +#define RTP_PROPOSAL_UMB 60 +#define RTP_PROPOSAL_SOLICIT 61 /* request reply of all RTM_PROPOSAL */ #define RTP_MAX 63 /* maximum priority */ #define RTP_ANY 64 /* any of the above */ #define RTP_MASK 0x7f @@ -316,6 +317,12 @@ struct sockaddr_rtdns { char sr_dns[RTDNS_LEN]; }; +static inline struct sockaddr * +srtdnstosa(struct sockaddr_rtdns *sdns) +{ + return ((struct sockaddr *)(sdns)); +} + #define RTSTATIC_LEN 128 struct sockaddr_rtstatic { @@ -427,6 +434,7 @@ struct sockaddr *rt_plen2mask(struct rtentry *, struct sockaddr_in6 *); void rtm_send(struct rtentry *, int, int, unsigned int); void rtm_addr(int, struct ifaddr *); void rtm_miss(int, struct rt_addrinfo *, int, uint8_t, u_int, int, u_int); +void rtm_proposal(struct ifnet *, struct rt_addrinfo *, int, uint8_t); int rt_setgate(struct rtentry *, struct sockaddr *, u_int); struct rtentry *rt_getll(struct rtentry *); diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 076834e8191..161c4bc998c 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.294 2019/11/06 15:18:53 florian Exp $ */ +/* $OpenBSD: rtsock.c,v 1.295 2019/11/22 06:20:15 claudio Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -1817,6 +1817,30 @@ rtm_80211info(struct ifnet *ifp, struct if_ieee80211_data *ifie) } /* + * This is used to generate routing socket messages indicating + * the address selection proposal from an interface. + */ +void +rtm_proposal(struct ifnet *ifp, struct rt_addrinfo *rtinfo, int flags, + uint8_t prio) +{ + struct rt_msghdr *rtm; + struct mbuf *m; + + m = rtm_msg1(RTM_PROPOSAL, rtinfo); + if (m == NULL) + return; + rtm = mtod(m, struct rt_msghdr *); + rtm->rtm_flags = RTF_DONE | flags; + rtm->rtm_priority = prio; + rtm->rtm_tableid = ifp->if_rdomain; + rtm->rtm_index = ifp->if_index; + rtm->rtm_addrs = rtinfo->rti_addrs; + + route_input(m, NULL, rtinfo->rti_info[RTAX_DNS]->sa_family); +} + +/* * This is used in dumping the kernel table via sysctl(). */ int |