diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2014-09-03 08:51:02 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2014-09-03 08:51:02 +0000 |
commit | fc6e69a06731f7afb954ce97595fa7a0cfa27f16 (patch) | |
tree | e3a869e9c4a66b259d1bd2289aa3e5faa8a57891 /sys/net/route.c | |
parent | cb72ea5ffa1fb11b0d155b40d19cbbf4b3be2af6 (diff) |
Treat broadcast entries like local ones and give them the highest
route priority.
While here document a RTM_ADD message is only send to userland for
local entries.
ok mikeb@, florian@
Diffstat (limited to 'sys/net/route.c')
-rw-r--r-- | sys/net/route.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/net/route.c b/sys/net/route.c index 3718bce4e0d..1fdac6ae619 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.181 2014/08/26 15:09:26 mpi Exp $ */ +/* $OpenBSD: route.c,v 1.182 2014/09/03 08:51:01 mpi Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -791,7 +791,8 @@ rtrequest1(int req, struct rt_addrinfo *info, u_int8_t prio, * sure that local routes are only modified by the * kernel. */ - if (rt->rt_flags & RTF_LOCAL && prio != RTP_LOCAL) + if ((rt->rt_flags & (RTF_LOCAL|RTF_BROADCAST)) && + prio != RTP_LOCAL) senderr(EINVAL); if ((rn = rnh->rnh_deladdr(info->rti_info[RTAX_DST], @@ -1110,7 +1111,7 @@ rt_ifa_add(struct ifaddr *ifa, int flags, struct sockaddr *dst) if ((flags & RTF_HOST) == 0) info.rti_info[RTAX_NETMASK] = ifa->ifa_netmask; - if (flags & RTF_LOCAL) + if (flags & (RTF_LOCAL|RTF_BROADCAST)) prio = RTP_LOCAL; error = rtrequest1(RTM_ADD, &info, prio, &nrt, rtableid); @@ -1128,6 +1129,12 @@ rt_ifa_add(struct ifaddr *ifa, int flags, struct sockaddr *dst) if (ifa->ifa_rtrequest) ifa->ifa_rtrequest(RTM_ADD, rt); } + + /* + * A local route is created for every address configured + * on an interface, so use this information to notify + * userland that a new address has been added. + */ if (flags & RTF_LOCAL) rt_newaddrmsg(RTM_ADD, ifa, error, nrt); } @@ -1178,7 +1185,7 @@ rt_ifa_del(struct ifaddr *ifa, int flags, struct sockaddr *dst) if ((flags & RTF_HOST) == 0) info.rti_info[RTAX_NETMASK] = ifa->ifa_netmask; - if (flags & RTF_LOCAL) + if (flags & (RTF_LOCAL|RTF_BROADCAST)) prio = RTP_LOCAL; error = rtrequest1(RTM_DELETE, &info, prio, &nrt, rtableid); |