summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1998-07-06 09:06:58 +0000
committerjulian <julian@FreeBSD.org>1998-07-06 09:06:58 +0000
commit8f07ff9316ea118fec705f945c6bae6a1ba60a9f (patch)
tree2eb77d6449bd730626eab9d495be0886f38480c0 /sys
parentbeb07fe1b82dfa0236722c7bc4891a23f8557fec (diff)
downloadFreeBSD-src-8f07ff9316ea118fec705f945c6bae6a1ba60a9f.zip
FreeBSD-src-8f07ff9316ea118fec705f945c6bae6a1ba60a9f.tar.gz
Bring back some slight cleanups from 2.2
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/ip_divert.c14
-rw-r--r--sys/netinet/ip_input.c13
2 files changed, 21 insertions, 6 deletions
diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
index 6b2b606..87ae671 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;
/*
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index f3533b9..bc7423d 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ip_input.c 8.2 (Berkeley) 1/4/94
- * $Id: ip_input.c,v 1.92 1998/07/06 03:20:16 julian Exp $
+ * $Id: ip_input.c,v 1.93 1998/07/06 05:00:52 julian Exp $
* $ANA: ip_input.c,v 1.5 1996/09/18 14:34:59 wollman Exp $
*/
@@ -607,6 +607,8 @@ found:
#ifdef IPDIVERT
/*
* Divert reassembled packets to the divert protocol if required
+ * If divert port is null then cookie should be too,
+ * so we shouldn't need to clear them here. Assume ip_divert does so.
*/
if (frag_divert_port) {
ipstat.ips_delivered++;
@@ -736,7 +738,8 @@ ip_reass(ip, fp, where)
* While we overlap succeeding segments trim them or,
* if they are completely covered, dequeue them.
*/
- while (q != (struct ipasfrag *)fp && ip->ip_off + ip->ip_len > q->ip_off) {
+ while (q != (struct ipasfrag *)fp &&
+ ip->ip_off + ip->ip_len > q->ip_off) {
struct mbuf *m0;
i = (ip->ip_off + ip->ip_len) - q->ip_off;
@@ -758,7 +761,7 @@ insert:
/*
* Any fragment diverting causes the whole packet to divert
*/
- if (frag_divert_port != 0) {
+ if (frag_divert_port) {
fp->ipq_divert = frag_divert_port;
fp->ipq_div_cookie = ip_divert_cookie;
}
@@ -840,6 +843,10 @@ insert:
return ((struct ip *)ip);
dropfrag:
+#ifdef IPDIVERT
+ frag_divert_port = 0;
+ ip_divert_cookie = 0;
+#endif
ipstat.ips_fragdropped++;
m_freem(m);
return (0);
OpenPOWER on IntegriCloud