summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_output.c
diff options
context:
space:
mode:
authorandre <andre@FreeBSD.org>2006-09-06 17:12:10 +0000
committerandre <andre@FreeBSD.org>2006-09-06 17:12:10 +0000
commitf044a1949bf52ae215c04b5885db0a0fa58680cf (patch)
tree8e42e2925da63abb07951c584de02d0033376b2f /sys/netinet/ip_output.c
parent3e9b75279e471e38cf330554242d87ab268a4b01 (diff)
downloadFreeBSD-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/netinet/ip_output.c')
-rw-r--r--sys/netinet/ip_output.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 8efc288..79d3806 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -198,6 +198,17 @@ again:
ifp = ia->ia_ifp;
ip->ip_ttl = 1;
isbroadcast = in_broadcast(dst->sin_addr, ifp);
+ } else if (flags & IP_SENDONES) {
+ if ((ia = ifatoia(ifa_ifwithbroadaddr(sintosa(dst)))) == NULL) {
+ ipstat.ips_noroute++;
+ error = ENETUNREACH;
+ goto bad;
+ }
+ ifp = ia->ia_ifp;
+ ip->ip_dst.s_addr = INADDR_BROADCAST;
+ dst->sin_addr = ip->ip_dst;
+ ip->ip_ttl = 1;
+ isbroadcast = 1;
} else if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) &&
imo != NULL && imo->imo_multicast_ifp != NULL) {
/*
@@ -381,8 +392,6 @@ again:
error = EMSGSIZE;
goto bad;
}
- if (flags & IP_SENDONES)
- ip->ip_dst.s_addr = INADDR_BROADCAST;
m->m_flags |= M_BCAST;
} else {
m->m_flags &= ~M_BCAST;
OpenPOWER on IntegriCloud