diff options
author | Julian Elischer <julian@FreeBSD.org> | 1998-07-06 09:06:58 +0000 |
---|---|---|
committer | Julian Elischer <julian@FreeBSD.org> | 1998-07-06 09:06:58 +0000 |
commit | efe39c6a1afbfa6d8ee71b116a8aa4a1625911ff (patch) | |
tree | 76b91ac88a8588810d7e0c0f2b0acac90a3896e5 /sys/netinet/ip_divert.c | |
parent | e37a54892bfa43bf7c62f5efcabcdc4e3b87c92d (diff) | |
download | src-efe39c6a1afbfa6d8ee71b116a8aa4a1625911ff.tar.gz src-efe39c6a1afbfa6d8ee71b116a8aa4a1625911ff.zip |
Bring back some slight cleanups from 2.2
Notes
Notes:
svn path=/head/; revision=37433
Diffstat (limited to 'sys/netinet/ip_divert.c')
-rw-r--r-- | sys/netinet/ip_divert.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index 6b2b6062ec4e..87ae6715b5db 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ip_divert.c,v 1.32 1998/07/02 05:49:07 julian Exp $ + * $Id: ip_divert.c,v 1.33 1998/07/02 06:31:25 julian Exp $ */ #include "opt_inet.h" @@ -156,7 +156,7 @@ div_input(struct mbuf *m, int hlen) } ip = mtod(m, struct ip *); - /* Record divert port */ + /* Record divert cookie */ divsrc.sin_port = ip_divert_cookie; ip_divert_cookie = 0; @@ -165,7 +165,10 @@ div_input(struct mbuf *m, int hlen) HTONS(ip->ip_len); HTONS(ip->ip_off); - /* Record receive interface address, if any */ + /* + * Record receive interface address, if any + * But only for incoming packets. + */ divsrc.sin_addr.s_addr = 0; if (hlen) { struct ifaddr *ifa; @@ -191,6 +194,9 @@ div_input(struct mbuf *m, int hlen) break; } } + /* + * Record the incoming interface name whenever we have one. + */ if (m->m_pkthdr.rcvif) { char name[32]; /* @@ -222,6 +228,7 @@ div_input(struct mbuf *m, int hlen) if (inp->inp_lport == htons(ip_divert_port)) sa = inp->inp_socket; } + ip_divert_port = 0; if (sa) { if (sbappendaddr(&sa->so_rcv, (struct sockaddr *)&divsrc, m, (struct mbuf *)0) == 0) @@ -261,6 +268,7 @@ div_output(so, m, addr, control) if (sin) { int len = 0; char *c = sin->sin_zero; + ip_divert_cookie = sin->sin_port; /* |