aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/ip_fastfwd.c
diff options
context:
space:
mode:
authorAndre Oppermann <andre@FreeBSD.org>2005-08-22 12:06:26 +0000
committerAndre Oppermann <andre@FreeBSD.org>2005-08-22 12:06:26 +0000
commitd56ea155bdd83cea76616a40005c00a26af84d07 (patch)
treeb4c71c9a2d965187f72fabed29e4fb0335b143f8 /sys/netinet/ip_fastfwd.c
parent971846e49c0f395d86399230c309eaea13a3c004 (diff)
downloadsrc-d56ea155bdd83cea76616a40005c00a26af84d07.tar.gz
src-d56ea155bdd83cea76616a40005c00a26af84d07.zip
Handle pure layer 2 broad- and multicasts properly and simplify related
checks. PR: kern/85052 Submitted by: Dmitrij Tejblum <tejblum at yandex-team.ru> MFC after: 3 days
Notes
Notes: svn path=/head/; revision=149369
Diffstat (limited to 'sys/netinet/ip_fastfwd.c')
-rw-r--r--sys/netinet/ip_fastfwd.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/sys/netinet/ip_fastfwd.c b/sys/netinet/ip_fastfwd.c
index 6c5f669311f2..8a84078ef82a 100644
--- a/sys/netinet/ip_fastfwd.c
+++ b/sys/netinet/ip_fastfwd.c
@@ -157,8 +157,6 @@ ip_fastforward(struct mbuf *m)
struct mbuf *m0 = NULL;
struct route ro;
struct sockaddr_in *dst = NULL;
- struct in_ifaddr *ia = NULL;
- struct ifaddr *ifa = NULL;
struct ifnet *ifp;
struct in_addr odest, dest;
u_short sum, ip_len;
@@ -313,11 +311,13 @@ ip_fastforward(struct mbuf *m)
* let ip_input handle it. We play safe here and let ip_input
* deal with it until it is proven that we can directly drop it.
*/
- if ((m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK) ||
+ if ((m->m_flags & (M_BCAST|M_MCAST)) ||
+ (m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK) ||
ntohl(ip->ip_src.s_addr) == (u_long)INADDR_BROADCAST ||
ntohl(ip->ip_dst.s_addr) == (u_long)INADDR_BROADCAST ||
IN_MULTICAST(ntohl(ip->ip_src.s_addr)) ||
IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) ||
+ ip->ip_src.s_addr == INADDR_ANY ||
ip->ip_dst.s_addr == INADDR_ANY )
return 0;
@@ -327,22 +327,6 @@ ip_fastforward(struct mbuf *m)
if (in_localip(ip->ip_dst))
return 0;
- /*
- * Or is it for a local IP broadcast address on this host?
- */
- if ((m->m_flags & M_BCAST) &&
- (m->m_pkthdr.rcvif->if_flags & IFF_BROADCAST)) {
- TAILQ_FOREACH(ifa, &m->m_pkthdr.rcvif->if_addrhead, ifa_link) {
- if (ifa->ifa_addr->sa_family != AF_INET)
- continue;
- ia = ifatoia(ifa);
- if (ia->ia_netbroadcast.s_addr == ip->ip_dst.s_addr)
- return 0;
- if (satosin(&ia->ia_broadaddr)->sin_addr.s_addr ==
- ip->ip_dst.s_addr)
- return 0;
- }
- }
ipstat.ips_total++;
/*