Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet Protect sysctl_net_inet_ip_pmtudto with icmp_mtx...
details: https://anonhg.NetBSD.org/src/rev/e52e8a07089f
branches: trunk
changeset: 351525:e52e8a07089f
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Fri Feb 17 04:32:10 2017 +0000
description:
Protect sysctl_net_inet_ip_pmtudto with icmp_mtx instead of softnet_lock
diffstat:
sys/netinet/ip_icmp.c | 18 ++++++++++++++++--
sys/netinet/ip_icmp.h | 4 +++-
sys/netinet/ip_input.c | 25 +++++++++++++------------
3 files changed, 32 insertions(+), 15 deletions(-)
diffs (111 lines):
diff -r fb0510161c6e -r e52e8a07089f sys/netinet/ip_icmp.c
--- a/sys/netinet/ip_icmp.c Fri Feb 17 04:31:34 2017 +0000
+++ b/sys/netinet/ip_icmp.c Fri Feb 17 04:32:10 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_icmp.c,v 1.158 2017/02/13 07:18:20 ozaki-r Exp $ */
+/* $NetBSD: ip_icmp.c,v 1.159 2017/02/17 04:32:10 ozaki-r Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -94,7 +94,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.158 2017/02/13 07:18:20 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.159 2017/02/17 04:32:10 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_ipsec.h"
@@ -205,6 +205,20 @@
icmp_wqinput = wqinput_create("icmp", _icmp_input);
}
+void
+icmp_mtudisc_lock(void)
+{
+
+ mutex_enter(&icmp_mtx);
+}
+
+void
+icmp_mtudisc_unlock(void)
+{
+
+ mutex_exit(&icmp_mtx);
+}
+
/*
* Register a Path MTU Discovery callback.
*/
diff -r fb0510161c6e -r e52e8a07089f sys/netinet/ip_icmp.h
--- a/sys/netinet/ip_icmp.h Fri Feb 17 04:31:34 2017 +0000
+++ b/sys/netinet/ip_icmp.h Fri Feb 17 04:32:10 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_icmp.h,v 1.34 2015/02/18 17:00:15 christos Exp $ */
+/* $NetBSD: ip_icmp.h,v 1.35 2017/02/17 04:32:10 ozaki-r Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@@ -248,6 +248,8 @@
void icmp_mtudisc_callback_register(void (*)(struct in_addr));
int icmp_ratelimit(const struct in_addr *, const int, const int);
+void icmp_mtudisc_lock(void);
+void icmp_mtudisc_unlock(void);
#endif
diff -r fb0510161c6e -r e52e8a07089f sys/netinet/ip_input.c
--- a/sys/netinet/ip_input.c Fri Feb 17 04:31:34 2017 +0000
+++ b/sys/netinet/ip_input.c Fri Feb 17 04:32:10 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_input.c,v 1.349 2017/02/07 02:38:08 ozaki-r Exp $ */
+/* $NetBSD: ip_input.c,v 1.350 2017/02/17 04:32:10 ozaki-r 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.349 2017/02/07 02:38:08 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.350 2017/02/17 04:32:10 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -1601,24 +1601,25 @@
int error, tmp;
struct sysctlnode node;
+ icmp_mtudisc_lock();
+
node = *rnode;
tmp = ip_mtudisc_timeout;
node.sysctl_data = &tmp;
error = sysctl_lookup(SYSCTLFN_CALL(&node));
if (error || newp == NULL)
- return (error);
- if (tmp < 0)
- return (EINVAL);
-
- /* XXX NOMPSAFE still need softnet_lock */
- mutex_enter(softnet_lock);
+ goto out;
+ if (tmp < 0) {
+ error = EINVAL;
+ goto out;
+ }
ip_mtudisc_timeout = tmp;
rt_timer_queue_change(ip_mtudisc_timeout_q, ip_mtudisc_timeout);
-
- mutex_exit(softnet_lock);
-
- return (0);
+ error = 0;
+out:
+ icmp_mtudisc_unlock();
+ return 0;
}
static int
Home |
Main Index |
Thread Index |
Old Index