summaryrefslogtreecommitdiff
path: root/sys/net/rtsock.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2019-11-22 06:20:16 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2019-11-22 06:20:16 +0000
commit4318702add378938f491265d7d1eafb27eedecd0 (patch)
tree852f7dd045a63081686782b9d480cad10bdd1f08 /sys/net/rtsock.c
parentdae55b315dba0f9dfae2859f628284c3f525fdce (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@
Diffstat (limited to 'sys/net/rtsock.c')
-rw-r--r--sys/net/rtsock.c26
1 files changed, 25 insertions, 1 deletions
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