diff options
author | andre <andre@FreeBSD.org> | 2006-09-06 17:12:10 +0000 |
---|---|---|
committer | andre <andre@FreeBSD.org> | 2006-09-06 17:12:10 +0000 |
commit | f044a1949bf52ae215c04b5885db0a0fa58680cf (patch) | |
tree | 8e42e2925da63abb07951c584de02d0033376b2f /sys/net/if.c | |
parent | 3e9b75279e471e38cf330554242d87ab268a4b01 (diff) | |
download | FreeBSD-src-f044a1949bf52ae215c04b5885db0a0fa58680cf.zip FreeBSD-src-f044a1949bf52ae215c04b5885db0a0fa58680cf.tar.gz |
Fix the socket option IP_ONESBCAST by giving it its own case in ip_output()
and skip over the normal IP processing.
Add a supporting function ifa_ifwithbroadaddr() to verify and validate the
supplied subnet broadcast address.
PR: kern/99558
Tested by: Andrey V. Elsukov <bu7cher-at-yandex.ru>
Sponsored by: TCP/IP Optimization Fundraise 2005
MFC after: 3 days
Diffstat (limited to 'sys/net/if.c')
-rw-r--r-- | sys/net/if.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index 33e26cd..278b4a8 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1006,6 +1006,33 @@ done: } /* + * Locate an interface based on the broadcast address. + */ +/* ARGSUSED */ +struct ifaddr * +ifa_ifwithbroadaddr(struct sockaddr *addr) +{ + struct ifnet *ifp; + struct ifaddr *ifa; + + IFNET_RLOCK(); + TAILQ_FOREACH(ifp, &ifnet, if_link) + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + if (ifa->ifa_addr->sa_family != addr->sa_family) + continue; + if ((ifp->if_flags & IFF_BROADCAST) && + ifa->ifa_broadaddr && + ifa->ifa_broadaddr->sa_len != 0 && + sa_equal(ifa->ifa_broadaddr, addr)) + goto done; + } + ifa = NULL; +done: + IFNET_RUNLOCK(); + return (ifa); +} + +/* * Locate the point to point interface with a given destination address. */ /*ARGSUSED*/ |