Module Name:    src
Committed By:   maxv
Date:           Tue Jul 10 15:46:58 UTC 2018

Modified Files:
        src/sys/net/npf: npf_handler.c
        src/sys/netinet: ip_input.c ip_reass.c ip_var.h

Log Message:
Remove the second argument from ip_reass_packet(). We want the IP header
on the mbuf, not elsewhere. Simplifies the NPF reassembly code a little.
No real functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/net/npf/npf_handler.c
cvs rdiff -u -r1.384 -r1.385 src/sys/netinet/ip_input.c
cvs rdiff -u -r1.17 -r1.18 src/sys/netinet/ip_reass.c
cvs rdiff -u -r1.125 -r1.126 src/sys/netinet/ip_var.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/npf/npf_handler.c
diff -u src/sys/net/npf/npf_handler.c:1.42 src/sys/net/npf/npf_handler.c:1.43
--- src/sys/net/npf/npf_handler.c:1.42	Tue Jul 10 15:25:01 2018
+++ src/sys/net/npf/npf_handler.c	Tue Jul 10 15:46:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_handler.c,v 1.42 2018/07/10 15:25:01 maxv Exp $	*/
+/*	$NetBSD: npf_handler.c,v 1.43 2018/07/10 15:46:58 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2009-2013 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #ifdef _KERNEL
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf_handler.c,v 1.42 2018/07/10 15:25:01 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_handler.c,v 1.43 2018/07/10 15:46:58 maxv Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -83,8 +83,7 @@ npf_reassembly(npf_t *npf, npf_cache_t *
 	nbuf_reset(nbuf);
 
 	if (npf_iscached(npc, NPC_IP4)) {
-		struct ip *ip = nbuf_dataptr(nbuf);
-		error = ip_reass_packet(&m, ip);
+		error = ip_reass_packet(&m);
 		KASSERT(!error || (m != NULL));
 	} else if (npf_iscached(npc, NPC_IP6)) {
 		error = ip6_reass_packet(&m, npc->npc_hlen);

Index: src/sys/netinet/ip_input.c
diff -u src/sys/netinet/ip_input.c:1.384 src/sys/netinet/ip_input.c:1.385
--- src/sys/netinet/ip_input.c:1.384	Thu May 17 11:59:36 2018
+++ src/sys/netinet/ip_input.c	Tue Jul 10 15:46:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_input.c,v 1.384 2018/05/17 11:59:36 maxv Exp $	*/
+/*	$NetBSD: ip_input.c,v 1.385 2018/07/10 15:46:58 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.384 2018/05/17 11:59:36 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.385 2018/07/10 15:46:58 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -752,7 +752,7 @@ ours:
 		/*
 		 * Pass to IP reassembly mechanism.
 		 */
-		if (ip_reass_packet(&m, ip) != 0) {
+		if (ip_reass_packet(&m) != 0) {
 			/* Failed; invalid fragment(s) or packet. */
 			goto out;
 		}

Index: src/sys/netinet/ip_reass.c
diff -u src/sys/netinet/ip_reass.c:1.17 src/sys/netinet/ip_reass.c:1.18
--- src/sys/netinet/ip_reass.c:1.17	Tue May 15 19:16:38 2018
+++ src/sys/netinet/ip_reass.c	Tue Jul 10 15:46:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_reass.c,v 1.17 2018/05/15 19:16:38 maxv Exp $	*/
+/*	$NetBSD: ip_reass.c,v 1.18 2018/07/10 15:46:58 maxv Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1988, 1993
@@ -46,7 +46,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_reass.c,v 1.17 2018/05/15 19:16:38 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_reass.c,v 1.18 2018/07/10 15:46:58 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -612,11 +612,12 @@ ip_reass_slowtimo(void)
  * => On complete, m0 represents a constructed final packet.
  */
 int
-ip_reass_packet(struct mbuf **m0, struct ip *ip)
+ip_reass_packet(struct mbuf **m0)
 {
+	struct mbuf *m = *m0;
+	struct ip *ip = mtod(m, struct ip *);
 	const int hlen = ip->ip_hl << 2;
 	const int len = ntohs(ip->ip_len);
-	struct mbuf *m = *m0;
 	int ipsecflags = m->m_flags & (M_DECRYPTED|M_AUTHIPHDR);
 	ipfr_queue_t *fp;
 	ipfr_qent_t *ipqe;

Index: src/sys/netinet/ip_var.h
diff -u src/sys/netinet/ip_var.h:1.125 src/sys/netinet/ip_var.h:1.126
--- src/sys/netinet/ip_var.h:1.125	Sun Apr  8 12:18:06 2018
+++ src/sys/netinet/ip_var.h	Tue Jul 10 15:46:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_var.h,v 1.125 2018/04/08 12:18:06 maxv Exp $	*/
+/*	$NetBSD: ip_var.h,v 1.126 2018/07/10 15:46:58 maxv Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -209,7 +209,7 @@ int	 ip_output(struct mbuf *, struct mbu
 int	 ip_fragment(struct mbuf *, struct ifnet *, u_long);
 
 void	 ip_reass_init(void);
-int	 ip_reass_packet(struct mbuf **, struct ip *);
+int	 ip_reass_packet(struct mbuf **);
 void	 ip_reass_slowtimo(void);
 void	 ip_reass_drain(void);
 

Reply via email to