Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Remove the second argument from ip_reass_packet(). We wa...



details:   https://anonhg.NetBSD.org/src/rev/83afa5a78c12
branches:  trunk
changeset: 833742:83afa5a78c12
user:      maxv <maxv%NetBSD.org@localhost>
date:      Tue Jul 10 15:46:58 2018 +0000

description:
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.

diffstat:

 sys/net/npf/npf_handler.c |  7 +++----
 sys/netinet/ip_input.c    |  6 +++---
 sys/netinet/ip_reass.c    |  9 +++++----
 sys/netinet/ip_var.h      |  4 ++--
 4 files changed, 13 insertions(+), 13 deletions(-)

diffs (106 lines):

diff -r 1eb57b25833b -r 83afa5a78c12 sys/net/npf/npf_handler.c
--- a/sys/net/npf/npf_handler.c Tue Jul 10 15:25:01 2018 +0000
+++ b/sys/net/npf/npf_handler.c Tue Jul 10 15:46:58 2018 +0000
@@ -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 @@
        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);
diff -r 1eb57b25833b -r 83afa5a78c12 sys/netinet/ip_input.c
--- a/sys/netinet/ip_input.c    Tue Jul 10 15:25:01 2018 +0000
+++ b/sys/netinet/ip_input.c    Tue Jul 10 15:46:58 2018 +0000
@@ -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 @@
                /*
                 * 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;
                }
diff -r 1eb57b25833b -r 83afa5a78c12 sys/netinet/ip_reass.c
--- a/sys/netinet/ip_reass.c    Tue Jul 10 15:25:01 2018 +0000
+++ b/sys/netinet/ip_reass.c    Tue Jul 10 15:46:58 2018 +0000
@@ -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 @@
  * => 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;
diff -r 1eb57b25833b -r 83afa5a78c12 sys/netinet/ip_var.h
--- a/sys/netinet/ip_var.h      Tue Jul 10 15:25:01 2018 +0000
+++ b/sys/netinet/ip_var.h      Tue Jul 10 15:46:58 2018 +0000
@@ -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_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);
 



Home | Main Index | Thread Index | Old Index