mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-14 08:44:27 +08:00
Reduce divergence from FreeBSD sources
This commit is contained in:
@@ -451,7 +451,7 @@ gif_output(ifp, m, dst, ro)
|
||||
|
||||
af = dst->sa_family;
|
||||
BPF_MTAP2(ifp, &af, sizeof(af), m);
|
||||
ifp->if_opackets++;
|
||||
ifp->if_opackets++;
|
||||
ifp->if_obytes += m->m_pkthdr.len;
|
||||
|
||||
/* override to IPPROTO_ETHERIP for bridged traffic */
|
||||
@@ -476,7 +476,7 @@ gif_output(ifp, m, dst, ro)
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
m_freem(m);
|
||||
m_freem(m);
|
||||
error = ENETDOWN;
|
||||
}
|
||||
|
||||
@@ -555,7 +555,7 @@ gif_input(m, af, ifp)
|
||||
}
|
||||
|
||||
eip = mtod(m, struct etherip_header *);
|
||||
/*
|
||||
/*
|
||||
* GIF_ACCEPT_REVETHIP (enabled by default) intentionally
|
||||
* accepts an EtherIP packet with revered version field in
|
||||
* the header. This is a knob for backward compatibility
|
||||
@@ -639,7 +639,7 @@ gif_ioctl(ifp, cmd, data)
|
||||
case SIOCSIFADDR:
|
||||
ifp->if_flags |= IFF_UP;
|
||||
break;
|
||||
|
||||
|
||||
case SIOCSIFDSTADDR:
|
||||
break;
|
||||
|
||||
|
@@ -460,7 +460,7 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
|
||||
error = EAFNOSUPPORT;
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
/* Reserve space for GRE header + optional GRE key */
|
||||
int hdrlen = sizeof(struct greip) + extra;
|
||||
if (sc->key)
|
||||
|
@@ -62,7 +62,7 @@
|
||||
* ICMPv6:
|
||||
* - Redirects cannot be used due to the lack of link-local address.
|
||||
*
|
||||
* stf interface does not have, and will not need, a link-local address.
|
||||
* stf interface does not have, and will not need, a link-local address.
|
||||
* It seems to have no real benefit and does not help the above symptoms much.
|
||||
* Even if we assign link-locals to interface, we cannot really
|
||||
* use link-local unicast/multicast on top of 6to4 cloud (since there's no
|
||||
|
@@ -463,7 +463,7 @@ tapcreate(struct cdev *dev)
|
||||
|
||||
knlist_init_mtx(&tp->tap_rsel.si_note, &tp->tap_mtx);
|
||||
|
||||
TAPDEBUG("interface %s is created. minor = %#x\n",
|
||||
TAPDEBUG("interface %s is created. minor = %#x\n",
|
||||
ifp->if_xname, dev2unit(dev));
|
||||
} /* tapcreate */
|
||||
|
||||
@@ -567,7 +567,7 @@ tapclose(struct cdev *dev, int foo, int bar, struct thread *td)
|
||||
tp->tap_pid = 0;
|
||||
mtx_unlock(&tp->tap_mtx);
|
||||
|
||||
TAPDEBUG("%s is closed. minor = %#x\n",
|
||||
TAPDEBUG("%s is closed. minor = %#x\n",
|
||||
ifp->if_xname, dev2unit(dev));
|
||||
|
||||
return (0);
|
||||
@@ -663,7 +663,7 @@ tapifstart(struct ifnet *ifp)
|
||||
struct mbuf *m;
|
||||
|
||||
/* Unlocked read. */
|
||||
TAPDEBUG("%s not ready, tap_flags = 0x%x\n", ifp->if_xname,
|
||||
TAPDEBUG("%s not ready, tap_flags = 0x%x\n", ifp->if_xname,
|
||||
tp->tap_flags);
|
||||
|
||||
for (;;) {
|
||||
@@ -899,7 +899,7 @@ tapread(struct cdev *dev, struct uio *uio, int flag)
|
||||
}
|
||||
|
||||
if (m != NULL) {
|
||||
TAPDEBUG("%s dropping mbuf, minor = %#x\n", ifp->if_xname,
|
||||
TAPDEBUG("%s dropping mbuf, minor = %#x\n", ifp->if_xname,
|
||||
dev2unit(dev));
|
||||
m_freem(m);
|
||||
}
|
||||
@@ -921,7 +921,7 @@ tapwrite(struct cdev *dev, struct uio *uio, int flag)
|
||||
struct ifnet *ifp = tp->tap_ifp;
|
||||
struct mbuf *m;
|
||||
|
||||
TAPDEBUG("%s writting, minor = %#x\n",
|
||||
TAPDEBUG("%s writting, minor = %#x\n",
|
||||
ifp->if_xname, dev2unit(dev));
|
||||
|
||||
if (uio->uio_resid == 0)
|
||||
@@ -983,7 +983,7 @@ tappoll(struct cdev *dev, int events, struct thread *td)
|
||||
struct ifnet *ifp = tp->tap_ifp;
|
||||
int revents = 0;
|
||||
|
||||
TAPDEBUG("%s polling, minor = %#x\n",
|
||||
TAPDEBUG("%s polling, minor = %#x\n",
|
||||
ifp->if_xname, dev2unit(dev));
|
||||
|
||||
if (events & (POLLIN | POLLRDNORM)) {
|
||||
|
@@ -622,7 +622,7 @@ tunoutput(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst,
|
||||
/* BPF writes need to be handled specially. */
|
||||
if (dst->sa_family == AF_UNSPEC) {
|
||||
bcopy(dst->sa_data, &af, sizeof(af));
|
||||
dst->sa_family = af;
|
||||
dst->sa_family = af;
|
||||
}
|
||||
|
||||
if (bpf_peers_present(ifp->if_bpf)) {
|
||||
|
@@ -1036,7 +1036,7 @@ netisr_start_swi(u_int cpuid, struct pcpu *pc)
|
||||
nws_array[nws_count] = nwsp->nws_cpu;
|
||||
nws_count++;
|
||||
NETISR_WUNLOCK();
|
||||
#endif
|
||||
#endif /* __rtems__ */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -79,11 +79,11 @@ rn_mpath_next(struct radix_node *rn)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef __rtems__
|
||||
u_int32_t
|
||||
#else
|
||||
#ifndef __rtems__
|
||||
uint32_t
|
||||
#endif
|
||||
#else /* __rtems__ */
|
||||
u_int32_t
|
||||
#endif /* __rtems__ */
|
||||
rn_mpath_count(struct radix_node *rn)
|
||||
{
|
||||
uint32_t i = 0;
|
||||
@@ -262,11 +262,11 @@ different:
|
||||
}
|
||||
|
||||
void
|
||||
#ifdef __rtems__
|
||||
rtalloc_mpath_fib(struct route *ro, u_int32_t hash, u_int fibnum)
|
||||
#else
|
||||
#ifndef __rtems__
|
||||
rtalloc_mpath_fib(struct route *ro, uint32_t hash, u_int fibnum)
|
||||
#endif
|
||||
#else /* __rtems__ */
|
||||
rtalloc_mpath_fib(struct route *ro, u_int32_t hash, u_int fibnum)
|
||||
#endif /* __rtems__ */
|
||||
{
|
||||
struct radix_node *rn0, *rn;
|
||||
u_int32_t n;
|
||||
|
@@ -153,7 +153,7 @@ sysctl_my_fibnum(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
int fibnum;
|
||||
int error;
|
||||
|
||||
|
||||
fibnum = curthread->td_proc->p_fibnum;
|
||||
error = sysctl_handle_int(oidp, &fibnum, 0, req);
|
||||
return (error);
|
||||
@@ -388,7 +388,7 @@ rtalloc1_fib(struct sockaddr *dst, int report, u_long ignflags,
|
||||
needlock = !(ignflags & RTF_RNH_LOCKED);
|
||||
if (needlock)
|
||||
RADIX_NODE_HEAD_RLOCK(rnh);
|
||||
#ifdef INVARIANTS
|
||||
#ifdef INVARIANTS
|
||||
else
|
||||
RADIX_NODE_HEAD_LOCK_ASSERT(rnh);
|
||||
#endif
|
||||
@@ -403,7 +403,7 @@ rtalloc1_fib(struct sockaddr *dst, int report, u_long ignflags,
|
||||
|
||||
} else if (needlock)
|
||||
RADIX_NODE_HEAD_RUNLOCK(rnh);
|
||||
|
||||
|
||||
/*
|
||||
* Either we hit the root or couldn't find any match,
|
||||
* Which basically means
|
||||
@@ -588,7 +588,7 @@ rtredirect_fib(struct sockaddr *dst,
|
||||
create:
|
||||
rt0 = rt;
|
||||
rt = NULL;
|
||||
|
||||
|
||||
flags |= RTF_GATEWAY | RTF_DYNAMIC;
|
||||
bzero((caddr_t)&info, sizeof(info));
|
||||
info.rti_info[RTAX_DST] = dst;
|
||||
@@ -607,7 +607,7 @@ rtredirect_fib(struct sockaddr *dst,
|
||||
}
|
||||
if (rt0 != NULL)
|
||||
RTFREE(rt0);
|
||||
|
||||
|
||||
stat = &V_rtstat.rts_dynamic;
|
||||
} else {
|
||||
struct rtentry *gwrt;
|
||||
@@ -983,12 +983,12 @@ rn_mpath_update(int req, struct rt_addrinfo *info,
|
||||
RT_UNLOCK(rto);
|
||||
} else if (rt->rt_flags & RTF_GATEWAY) {
|
||||
/*
|
||||
* For gateway routes, we need to
|
||||
* For gateway routes, we need to
|
||||
* make sure that we we are deleting
|
||||
* the correct gateway.
|
||||
* rt_mpath_matchgate() does not
|
||||
* the correct gateway.
|
||||
* rt_mpath_matchgate() does not
|
||||
* check the case when there is only
|
||||
* one route in the chain.
|
||||
* one route in the chain.
|
||||
*/
|
||||
if (gateway &&
|
||||
(rt->rt_gateway->sa_len != gateway->sa_len ||
|
||||
@@ -1003,19 +1003,19 @@ rn_mpath_update(int req, struct rt_addrinfo *info,
|
||||
KASSERT(rt == RNTORT(rn), ("radix node disappeared"));
|
||||
goto gwdelete;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
* use the normal delete code to remove
|
||||
* the first entry
|
||||
*/
|
||||
if (req != RTM_DELETE)
|
||||
if (req != RTM_DELETE)
|
||||
goto nondelete;
|
||||
|
||||
error = ENOENT;
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* if the entry is 2nd and on up
|
||||
*/
|
||||
@@ -1033,11 +1033,11 @@ gwdelete:
|
||||
*/
|
||||
V_rttrash++;
|
||||
}
|
||||
|
||||
|
||||
nondelete:
|
||||
if (req != RTM_DELETE)
|
||||
panic("unrecognized request %d", req);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* If the caller wants it, then it can have it,
|
||||
@@ -1165,7 +1165,7 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
|
||||
case RTM_ADD:
|
||||
if ((flags & RTF_GATEWAY) && !gateway)
|
||||
senderr(EINVAL);
|
||||
if (dst && gateway && (dst->sa_family != gateway->sa_family) &&
|
||||
if (dst && gateway && (dst->sa_family != gateway->sa_family) &&
|
||||
(gateway->sa_family != AF_UNSPEC) && (gateway->sa_family != AF_LINK))
|
||||
senderr(EINVAL);
|
||||
|
||||
@@ -1251,7 +1251,7 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
|
||||
struct sockaddr *mask;
|
||||
u_char *m, *n;
|
||||
int len;
|
||||
|
||||
|
||||
/*
|
||||
* compare mask to see if the new route is
|
||||
* more specific than the existing one
|
||||
@@ -1261,7 +1261,7 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
|
||||
RT_ADDREF(rt0);
|
||||
RT_UNLOCK(rt0);
|
||||
/*
|
||||
* A host route is already present, so
|
||||
* A host route is already present, so
|
||||
* leave the flow-table entries as is.
|
||||
*/
|
||||
if (rt0->rt_flags & RTF_HOST) {
|
||||
@@ -1305,7 +1305,7 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
|
||||
RTFREE(rt0);
|
||||
#endif
|
||||
senderr(EEXIST);
|
||||
}
|
||||
}
|
||||
#ifdef FLOWTABLE
|
||||
else if (rt0 != NULL) {
|
||||
switch (dst->sa_family) {
|
||||
@@ -1373,7 +1373,7 @@ rt_setgate(struct rtentry *rt, struct sockaddr *dst, struct sockaddr *gate)
|
||||
|
||||
RT_LOCK_ASSERT(rt);
|
||||
RADIX_NODE_HEAD_LOCK_ASSERT(rnh);
|
||||
|
||||
|
||||
/*
|
||||
* Prepare to store the gateway in rt->rt_gateway.
|
||||
* Both dst and gateway are stored one after the other in the same
|
||||
@@ -1522,7 +1522,7 @@ rtinit1(struct ifaddr *ifa, int cmd, int flags, int fibnum)
|
||||
if (rn_mpath_capable(rnh)) {
|
||||
|
||||
rn = rnh->rnh_matchaddr(dst, rnh);
|
||||
if (rn == NULL)
|
||||
if (rn == NULL)
|
||||
error = ESRCH;
|
||||
else {
|
||||
rt = RNTORT(rn);
|
||||
@@ -1535,7 +1535,7 @@ rtinit1(struct ifaddr *ifa, int cmd, int flags, int fibnum)
|
||||
*/
|
||||
rt = rt_mpath_matchgate(rt,
|
||||
ifa->ifa_addr);
|
||||
if (!rt)
|
||||
if (!rt)
|
||||
error = ESRCH;
|
||||
}
|
||||
}
|
||||
@@ -1559,7 +1559,7 @@ rtinit1(struct ifaddr *ifa, int cmd, int flags, int fibnum)
|
||||
info.rti_ifa = ifa;
|
||||
info.rti_flags = flags | (ifa->ifa_flags & ~IFA_RTSELF);
|
||||
info.rti_info[RTAX_DST] = dst;
|
||||
/*
|
||||
/*
|
||||
* doing this for compatibility reasons
|
||||
*/
|
||||
if (cmd == RTM_ADD)
|
||||
@@ -1590,7 +1590,7 @@ rtinit1(struct ifaddr *ifa, int cmd, int flags, int fibnum)
|
||||
rt->rt_ifa = ifa;
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
/*
|
||||
* doing this for compatibility reasons
|
||||
*/
|
||||
if (cmd == RTM_ADD) {
|
||||
|
@@ -636,7 +636,7 @@ route_output(struct mbuf *m, struct socket *so)
|
||||
* The given gateway address may be an interface address.
|
||||
* For example, issuing a "route change" command on a route
|
||||
* entry that was created from a tunnel, and the gateway
|
||||
* address given is the local end point. In this case the
|
||||
* address given is the local end point. In this case the
|
||||
* RTF_GATEWAY flag must be cleared or the destination will
|
||||
* not be reachable even though there is no error message.
|
||||
*/
|
||||
@@ -647,11 +647,11 @@ route_output(struct mbuf *m, struct socket *so)
|
||||
bzero(&gw_ro, sizeof(gw_ro));
|
||||
gw_ro.ro_dst = *info.rti_info[RTAX_GATEWAY];
|
||||
rtalloc_ign_fib(&gw_ro, 0, so->so_fibnum);
|
||||
/*
|
||||
* A host route through the loopback interface is
|
||||
/*
|
||||
* A host route through the loopback interface is
|
||||
* installed for each interface adddress. In pre 8.0
|
||||
* releases the interface address of a PPP link type
|
||||
* is not reachable locally. This behavior is fixed as
|
||||
* is not reachable locally. This behavior is fixed as
|
||||
* part of the new L2/L3 redesign and rewrite work. The
|
||||
* signature of this interface address route is the
|
||||
* AF_LINK sa_family type of the rt_gateway, and the
|
||||
@@ -694,7 +694,7 @@ route_output(struct mbuf *m, struct socket *so)
|
||||
case RTM_DELETE:
|
||||
saved_nrt = NULL;
|
||||
/* support for new ARP code */
|
||||
if (info.rti_info[RTAX_GATEWAY] &&
|
||||
if (info.rti_info[RTAX_GATEWAY] &&
|
||||
(info.rti_info[RTAX_GATEWAY]->sa_family == AF_LINK) &&
|
||||
(rtm->rtm_flags & RTF_LLDATA) != 0) {
|
||||
error = lla_rt_output(rtm, &info);
|
||||
@@ -750,7 +750,7 @@ route_output(struct mbuf *m, struct socket *so)
|
||||
if (rtm->rtm_flags & RTF_ANNOUNCE) {
|
||||
struct sockaddr laddr;
|
||||
|
||||
if (rt->rt_ifp != NULL &&
|
||||
if (rt->rt_ifp != NULL &&
|
||||
rt->rt_ifp->if_type == IFT_PROPVIRTUAL) {
|
||||
struct ifaddr *ifa;
|
||||
|
||||
@@ -763,7 +763,7 @@ route_output(struct mbuf *m, struct socket *so)
|
||||
rt_maskedcopy(rt->rt_ifa->ifa_addr,
|
||||
&laddr,
|
||||
rt->rt_ifa->ifa_netmask);
|
||||
/*
|
||||
/*
|
||||
* refactor rt and no lock operation necessary
|
||||
*/
|
||||
rt = (struct rtentry *)rnh->rnh_matchaddr(&laddr, rnh);
|
||||
@@ -771,12 +771,12 @@ route_output(struct mbuf *m, struct socket *so)
|
||||
RADIX_NODE_HEAD_RUNLOCK(rnh);
|
||||
senderr(ESRCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
RT_LOCK(rt);
|
||||
RT_ADDREF(rt);
|
||||
RADIX_NODE_HEAD_RUNLOCK(rnh);
|
||||
|
||||
/*
|
||||
/*
|
||||
* Fix for PR: 82974
|
||||
*
|
||||
* RTM_CHANGE/LOCK need a perfect match, rn_lookup()
|
||||
@@ -789,7 +789,7 @@ route_output(struct mbuf *m, struct socket *so)
|
||||
* perfect match.
|
||||
*/
|
||||
|
||||
if (rtm->rtm_type != RTM_GET &&
|
||||
if (rtm->rtm_type != RTM_GET &&
|
||||
(!rt_mask(rt) != !info.rti_info[RTAX_NETMASK])) {
|
||||
RT_UNLOCK(rt);
|
||||
senderr(ESRCH);
|
||||
@@ -806,7 +806,7 @@ route_output(struct mbuf *m, struct socket *so)
|
||||
rt_key(rt)) != 0) {
|
||||
RT_UNLOCK(rt);
|
||||
senderr(ESRCH);
|
||||
}
|
||||
}
|
||||
info.rti_info[RTAX_DST] = rt_key(rt);
|
||||
info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
|
||||
info.rti_info[RTAX_NETMASK] = rt_mask(rt);
|
||||
@@ -819,7 +819,7 @@ route_output(struct mbuf *m, struct socket *so)
|
||||
error = rtm_get_jailed(&info, ifp, rt,
|
||||
&saun, curthread->td_ucred);
|
||||
if (error != 0) {
|
||||
RT_UNLOCK(rt);
|
||||
RT_UNLOCK(rt);
|
||||
senderr(error);
|
||||
}
|
||||
if (ifp->if_flags & IFF_POINTOPOINT)
|
||||
@@ -889,7 +889,7 @@ route_output(struct mbuf *m, struct socket *so)
|
||||
RT_UNLOCK(rt);
|
||||
RADIX_NODE_HEAD_LOCK(rnh);
|
||||
RT_LOCK(rt);
|
||||
|
||||
|
||||
error = rt_setgate(rt, rt_key(rt),
|
||||
info.rti_info[RTAX_GATEWAY]);
|
||||
RADIX_NODE_HEAD_UNLOCK(rnh);
|
||||
@@ -1032,7 +1032,7 @@ rt_xaddrs(caddr_t cp, caddr_t cplim, struct rt_addrinfo *rtinfo)
|
||||
/*
|
||||
* there are no more.. quit now
|
||||
* If there are more bits, they are in error.
|
||||
* I've seen this. route(1) can evidently generate these.
|
||||
* I've seen this. route(1) can evidently generate these.
|
||||
* This causes kernel to core dump.
|
||||
* for compatibility, If we see this, point to a safe address.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user