Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet Remove the 'm' argument from syn_cache_respond()...



details:   https://anonhg.NetBSD.org/src/rev/94cf7dfd80b3
branches:  trunk
changeset: 829774:94cf7dfd80b3
user:      maxv <maxv%NetBSD.org@localhost>
date:      Mon Feb 12 08:08:28 2018 +0000

description:
Remove the 'm' argument from syn_cache_respond(); all it does with it is
freeing it, so free in the caller instead.

diffstat:

 sys/netinet/tcp_input.c |  22 +++++++++++-----------
 sys/netinet/tcp_var.h   |   4 ++--
 2 files changed, 13 insertions(+), 13 deletions(-)

diffs (110 lines):

diff -r 4fbfa14911e2 -r 94cf7dfd80b3 sys/netinet/tcp_input.c
--- a/sys/netinet/tcp_input.c   Mon Feb 12 08:03:42 2018 +0000
+++ b/sys/netinet/tcp_input.c   Mon Feb 12 08:08:28 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_input.c,v 1.376 2018/02/12 08:03:42 maxv Exp $     */
+/*     $NetBSD: tcp_input.c,v 1.377 2018/02/12 08:08:28 maxv Exp $     */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.376 2018/02/12 08:03:42 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.377 2018/02/12 08:08:28 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3749,7 +3749,7 @@
                goto dropit;
 
        TCP_STATINC(TCP_STAT_SC_RETRANSMITTED);
-       (void) syn_cache_respond(sc, NULL);
+       (void)syn_cache_respond(sc);
 
        /* Advance the timer back-off. */
        sc->sc_rxtshift++;
@@ -3884,7 +3884,8 @@
        if ((th->th_ack != sc->sc_iss + 1) ||
            SEQ_LEQ(th->th_seq, sc->sc_irs) ||
            SEQ_GT(th->th_seq, sc->sc_irs + 1 + sc->sc_win)) {
-               (void) syn_cache_respond(sc, m);
+               m_freem(m);
+               (void)syn_cache_respond(sc);
                splx(s);
                return ((struct socket *)(-1));
        }
@@ -4302,7 +4303,8 @@
                        sc->sc_ipopts = ipopts;
                }
                sc->sc_timestamp = tb.ts_recent;
-               if (syn_cache_respond(sc, m) == 0) {
+               m_freem(m);
+               if (syn_cache_respond(sc) == 0) {
                        uint64_t *tcps = TCP_STAT_GETREF();
                        tcps[TCP_STAT_SNDACKS]++;
                        tcps[TCP_STAT_SNDTOTAL]++;
@@ -4411,7 +4413,8 @@
                sc->sc_flags |= SCF_SIGNATURE;
 #endif
        sc->sc_tp = tp;
-       if (syn_cache_respond(sc, m) == 0) {
+       m_freem(m);
+       if (syn_cache_respond(sc) == 0) {
                uint64_t *tcps = TCP_STAT_GETREF();
                tcps[TCP_STAT_SNDACKS]++;
                tcps[TCP_STAT_SNDTOTAL]++;
@@ -4438,7 +4441,7 @@
  */
 
 int
-syn_cache_respond(struct syn_cache *sc, struct mbuf *m)
+syn_cache_respond(struct syn_cache *sc)
 {
 #ifdef INET6
        struct rtentry *rt = NULL;
@@ -4453,6 +4456,7 @@
 #endif
        struct tcpcb *tp = NULL;
        struct tcphdr *th;
+       struct mbuf *m;
        u_int hlen;
 #ifdef TCP_SIGNATURE
        struct secasvar *sav = NULL;
@@ -4470,8 +4474,6 @@
                break;
 #endif
        default:
-               if (m)
-                       m_freem(m);
                return (EAFNOSUPPORT);
        }
 
@@ -4481,8 +4483,6 @@
        /*
         * Create the IP+TCP header from scratch.
         */
-       if (m)
-               m_freem(m);
 #ifdef DIAGNOSTIC
        if (max_linkhdr + tlen > MCLBYTES)
                return ENOBUFS;
diff -r 4fbfa14911e2 -r 94cf7dfd80b3 sys/netinet/tcp_var.h
--- a/sys/netinet/tcp_var.h     Mon Feb 12 08:03:42 2018 +0000
+++ b/sys/netinet/tcp_var.h     Mon Feb 12 08:08:28 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_var.h,v 1.182 2018/01/19 07:53:01 ozaki-r Exp $    */
+/*     $NetBSD: tcp_var.h,v 1.183 2018/02/12 08:08:28 maxv Exp $       */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -968,7 +968,7 @@
                struct syn_cache_head **);
 void    syn_cache_reset(struct sockaddr *, struct sockaddr *,
                struct tcphdr *);
-int     syn_cache_respond(struct syn_cache *, struct mbuf *);
+int     syn_cache_respond(struct syn_cache *);
 void    syn_cache_cleanup(struct tcpcb *);
 
 int     tcp_input_checksum(int, struct mbuf *, const struct tcphdr *, int, int,



Home | Main Index | Thread Index | Old Index