FreeBSD Bugzilla – Attachment 182485 Details for
Bug 209491
Broadcast storm with ipfw+natd+gateway
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch (untested)
ip_divert.diff (text/plain), 1.58 KB, created by
Andrey V. Elsukov
on 2017-05-10 20:39:19 UTC
(
hide
)
Description:
Proposed patch (untested)
Filename:
MIME Type:
Creator:
Andrey V. Elsukov
Created:
2017-05-10 20:39:19 UTC
Size:
1.58 KB
patch
obsolete
>Index: sys/netinet/ip_divert.c >=================================================================== >--- sys/netinet/ip_divert.c (revision 318135) >+++ sys/netinet/ip_divert.c (working copy) >@@ -317,6 +317,7 @@ div_output(struct socket *so, struct mbuf *m, stru > struct mbuf *control) > { > struct ip *const ip = mtod(m, struct ip *); >+ struct ifaddr *ifa; > struct m_tag *mtag; > struct ipfw_rule_ref *dt; > int error = 0; >@@ -471,8 +472,6 @@ div_output(struct socket *so, struct mbuf *m, stru > * Clear the port and the ifname to make sure > * there are no distractions for ifa_ifwithaddr. > */ >- struct ifaddr *ifa; >- > bzero(sin->sin_zero, sizeof(sin->sin_zero)); > sin->sin_port = 0; > ifa = ifa_ifwithaddr((struct sockaddr *) sin); >@@ -489,6 +488,27 @@ div_output(struct socket *so, struct mbuf *m, stru > /* Send packet to input processing via netisr */ > switch (ip->ip_v) { > case IPVERSION: >+ if (!(m->m_pkthdr.rcvif->if_flags & IFF_BROADCAST)) { >+ netisr_queue_src(NETISR_IP, (uintptr_t)so, m); >+ break; >+ } >+ /* >+ * Set M_BCAST flag when destination address is >+ * broadcast. It is expected by ip_tryforward(). >+ */ >+ if_addr_rlock(m->m_pkthdr.rcvif); >+ TAILQ_FOREACH(ifa, &m->m_pkthdr.rcvif->if_addrhead, >+ ifa_link) { >+ if (ifa->ifa_addr->sa_family != AF_INET) >+ continue; >+ if (satosin(&ifatoia( >+ ifa)->ia_broadaddr)->sin_addr.s_addr == >+ ip->ip_dst.s_addr) { >+ m->m_flags |= M_BCAST; >+ break; >+ } >+ } >+ if_addr_runlock(m->m_pkthdr.rcvif); > netisr_queue_src(NETISR_IP, (uintptr_t)so, m); > break; > #ifdef INET6
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 209491
:
182485
|
182486
|
182488