Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet Don't use global variables, that's obviously inc...



details:   https://anonhg.NetBSD.org/src/rev/9c8a313726d3
branches:  trunk
changeset: 829238:9c8a313726d3
user:      maxv <maxv%NetBSD.org@localhost>
date:      Tue Jan 23 07:33:49 2018 +0000

description:
Don't use global variables, that's obviously incorrect on MP systems.
One remains, because it is imported in tcp_timer.c, and I'm not totally
sure of how it interacts with icmp_mtudisc().

diffstat:

 sys/netinet/ip_icmp.c |  28 +++++++++++-----------------
 1 files changed, 11 insertions(+), 17 deletions(-)

diffs (65 lines):

diff -r 2f2eee4f62c3 -r 9c8a313726d3 sys/netinet/ip_icmp.c
--- a/sys/netinet/ip_icmp.c     Tue Jan 23 07:20:10 2018 +0000
+++ b/sys/netinet/ip_icmp.c     Tue Jan 23 07:33:49 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_icmp.c,v 1.165 2018/01/23 07:15:04 maxv Exp $       */
+/*     $NetBSD: ip_icmp.c,v 1.166 2018/01/23 07:33:49 maxv Exp $       */
 
 /*
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -94,7 +94,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.165 2018/01/23 07:15:04 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.166 2018/01/23 07:33:49 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ipsec.h"
@@ -403,21 +403,9 @@
 }
 
 struct sockaddr_in icmpsrc = {
-       .sin_len = sizeof (struct sockaddr_in),
-       .sin_family = AF_INET,
-};
-static struct sockaddr_in icmpdst = {
-       .sin_len = sizeof (struct sockaddr_in),
+       .sin_len = sizeof(struct sockaddr_in),
        .sin_family = AF_INET,
 };
-static struct sockaddr_in icmpgw = {
-       .sin_len = sizeof (struct sockaddr_in),
-       .sin_family = AF_INET,
-};
-struct sockaddr_in icmpmask = { 
-       .sin_len = 8,
-       .sin_family = 0,
-};
 
 /*
  * Process a received ICMP message.
@@ -433,6 +421,14 @@
        void *(*ctlfunc)(int, const struct sockaddr *, void *);
        int code;
        struct rtentry *rt;
+       struct sockaddr_in icmpdst = {
+               .sin_len = sizeof(struct sockaddr_in),
+               .sin_family = AF_INET,
+       };
+       struct sockaddr_in icmpgw = {
+               .sin_len = sizeof(struct sockaddr_in),
+               .sin_family = AF_INET,
+       };
 
        /*
         * Locate icmp structure in mbuf, and check
@@ -799,8 +795,6 @@
 
        sin = ia ? &ia->ia_addr : NULL;
 
-       icmpdst.sin_addr = t;
-
        /*
         * if the packet is addressed somewhere else, compute the
         * source address for packets routed back to the source, and



Home | Main Index | Thread Index | Old Index