summaryrefslogtreecommitdiffstats
path: root/sys/net/rtsock.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/net/rtsock.c')
-rw-r--r--sys/net/rtsock.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 9c13a07..a1e759b 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -434,6 +434,25 @@ route_output(struct mbuf *m, struct socket *so)
RT_LOCK(rt);
RT_ADDREF(rt);
+ /*
+ * Fix for PR: 82974
+ *
+ * RTM_CHANGE/LOCK need a perfect match, rn_lookup()
+ * returns a perfect match in case a netmask is
+ * specified. For host routes only a longest prefix
+ * match is returned so it is necessary to compare the
+ * existence of the netmask. If both have a netmask
+ * rnh_lookup() did a perfect match and if none of them
+ * have a netmask both are host routes which is also a
+ * perfect match.
+ */
+
+ if (rtm->rtm_type != RTM_GET &&
+ (!rt_mask(rt) != !info.rti_info[RTAX_NETMASK])) {
+ RT_UNLOCK(rt);
+ senderr(ESRCH);
+ }
+
switch(rtm->rtm_type) {
case RTM_GET:
OpenPOWER on IntegriCloud