diff options
Diffstat (limited to 'sys/net/rtsock.c')
-rw-r--r-- | sys/net/rtsock.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 5003b03..30591c7 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -53,6 +53,7 @@ #include <sys/vimage.h> #include <net/if.h> +#include <net/if_llatbl.h> #include <net/netisr.h> #include <net/raw_cb.h> #include <net/route.h> @@ -496,19 +497,6 @@ route_output(struct mbuf *m, struct socket *so) (info.rti_info[RTAX_GATEWAY] != NULL && info.rti_info[RTAX_GATEWAY]->sa_family >= AF_MAX)) senderr(EINVAL); - if (info.rti_info[RTAX_GENMASK]) { - struct radix_node *t; - t = rn_addmask((caddr_t) info.rti_info[RTAX_GENMASK], 0, 1); - if (t != NULL && - bcmp((char *)(void *)info.rti_info[RTAX_GENMASK] + 1, - (char *)(void *)t->rn_key + 1, - ((struct sockaddr *)t->rn_key)->sa_len - 1) == 0) - info.rti_info[RTAX_GENMASK] = - (struct sockaddr *)t->rn_key; - else - senderr(ENOBUFS); - } - /* * Verify that the caller has the appropriate privilege; RTM_GET * is the only operation the non-superuser is allowed. @@ -526,6 +514,11 @@ route_output(struct mbuf *m, struct socket *so) if (info.rti_info[RTAX_GATEWAY] == NULL) senderr(EINVAL); saved_nrt = NULL; + /* support for new ARP code */ + if (info.rti_info[RTAX_GATEWAY]->sa_family == AF_LINK) { + error = lla_rt_output(rtm, &info); + break; + } error = rtrequest1_fib(RTM_ADD, &info, &saved_nrt, so->so_fibnum); if (error == 0 && saved_nrt) { @@ -534,13 +527,18 @@ route_output(struct mbuf *m, struct socket *so) &rtm->rtm_rmx, &saved_nrt->rt_rmx); rtm->rtm_index = saved_nrt->rt_ifp->if_index; RT_REMREF(saved_nrt); - saved_nrt->rt_genmask = info.rti_info[RTAX_GENMASK]; RT_UNLOCK(saved_nrt); } break; case RTM_DELETE: saved_nrt = NULL; + /* support for new ARP code */ + if (info.rti_info[RTAX_GATEWAY] && + (info.rti_info[RTAX_GATEWAY]->sa_family == AF_LINK)) { + error = lla_rt_output(rtm, &info); + break; + } error = rtrequest1_fib(RTM_DELETE, &info, &saved_nrt, so->so_fibnum); if (error == 0) { @@ -612,7 +610,7 @@ route_output(struct mbuf *m, struct socket *so) info.rti_info[RTAX_DST] = rt_key(rt); info.rti_info[RTAX_GATEWAY] = rt->rt_gateway; info.rti_info[RTAX_NETMASK] = rt_mask(rt); - info.rti_info[RTAX_GENMASK] = rt->rt_genmask; + info.rti_info[RTAX_GENMASK] = 0; if (rtm->rtm_addrs & (RTA_IFP | RTA_IFA)) { ifp = rt->rt_ifp; if (ifp) { @@ -699,8 +697,7 @@ route_output(struct mbuf *m, struct socket *so) RT_UNLOCK(rt); senderr(error); } - if (!(rt->rt_flags & RTF_LLINFO)) - rt->rt_flags |= RTF_GATEWAY; + rt->rt_flags |= RTF_GATEWAY; } if (info.rti_ifa != NULL && info.rti_ifa != rt->rt_ifa) { @@ -718,8 +715,6 @@ route_output(struct mbuf *m, struct socket *so) rtm->rtm_index = rt->rt_ifp->if_index; if (rt->rt_ifa && rt->rt_ifa->ifa_rtrequest) rt->rt_ifa->ifa_rtrequest(RTM_ADD, rt, &info); - if (info.rti_info[RTAX_GENMASK]) - rt->rt_genmask = info.rti_info[RTAX_GENMASK]; /* FALLTHROUGH */ case RTM_LOCK: /* We don't support locks anymore */ @@ -1261,7 +1256,7 @@ sysctl_dumpentry(struct radix_node *rn, void *vw) info.rti_info[RTAX_DST] = rt_key(rt); info.rti_info[RTAX_GATEWAY] = rt->rt_gateway; info.rti_info[RTAX_NETMASK] = rt_mask(rt); - info.rti_info[RTAX_GENMASK] = rt->rt_genmask; + info.rti_info[RTAX_GENMASK] = 0; if (rt->rt_ifp) { info.rti_info[RTAX_IFP] = rt->rt_ifp->if_addr->ifa_addr; info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr; @@ -1440,6 +1435,11 @@ sysctl_rtsock(SYSCTL_HANDLER_ARGS) RADIX_NODE_HEAD_UNLOCK(rnh); } else if (af != 0) error = EAFNOSUPPORT; + /* + * take care of llinfo entries + */ + if (w.w_op == NET_RT_FLAGS) + error = lltable_sysctl_dumparp(af, w.w_req); break; case NET_RT_IFLIST: |