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 a single global variable as a temporal...
details: https://anonhg.NetBSD.org/src/rev/1cedbabcb046
branches: trunk
changeset: 352422:1cedbabcb046
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Fri Mar 31 06:42:19 2017 +0000
description:
Don't use a single global variable as a temporal storage for multiple packets
It's not MP-safe. So use local variables instead.
diffstat:
sys/netinet/ip_input.c | 31 +++++++++++++++++++++++--------
1 files changed, 23 insertions(+), 8 deletions(-)
diffs (87 lines):
diff -r 1dd19adcc79e -r 1cedbabcb046 sys/netinet/ip_input.c
--- a/sys/netinet/ip_input.c Fri Mar 31 06:41:40 2017 +0000
+++ b/sys/netinet/ip_input.c Fri Mar 31 06:42:19 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_input.c,v 1.352 2017/03/06 07:31:15 ozaki-r Exp $ */
+/* $NetBSD: ip_input.c,v 1.353 2017/03/31 06:42:19 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.352 2017/03/06 07:31:15 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.353 2017/03/31 06:42:19 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -271,11 +271,6 @@
static int ip_drainwanted;
-struct sockaddr_in ipaddr = {
- .sin_len = sizeof(ipaddr),
- .sin_family = AF_INET,
-};
-
static void save_rte(u_char *, struct in_addr);
#ifdef MBUFTRACE
@@ -950,6 +945,11 @@
case IPOPT_LSRR:
case IPOPT_SSRR: {
struct psref psref;
+ struct sockaddr_in ipaddr = {
+ .sin_len = sizeof(ipaddr),
+ .sin_family = AF_INET,
+ };
+
if (ip_allowsrcrt == 0) {
type = ICMP_UNREACH;
code = ICMP_UNREACH_NET_PROHIB;
@@ -1024,6 +1024,11 @@
case IPOPT_RR: {
struct psref psref;
+ struct sockaddr_in ipaddr = {
+ .sin_len = sizeof(ipaddr),
+ .sin_family = AF_INET,
+ };
+
if (optlen < IPOPT_OFFSET + sizeof(*cp)) {
code = &cp[IPOPT_OLEN] - (u_char *)ip;
goto bad;
@@ -1090,6 +1095,10 @@
case IPOPT_TS_TSANDADDR: {
struct ifnet *rcvif;
int _s, _ss;
+ struct sockaddr_in ipaddr = {
+ .sin_len = sizeof(ipaddr),
+ .sin_family = AF_INET,
+ };
if (ipt->ipt_ptr - 1 + sizeof(n_time) +
sizeof(struct in_addr) > ipt->ipt_len) {
@@ -1117,7 +1126,12 @@
break;
}
- case IPOPT_TS_PRESPEC:
+ case IPOPT_TS_PRESPEC: {
+ struct sockaddr_in ipaddr = {
+ .sin_len = sizeof(ipaddr),
+ .sin_family = AF_INET,
+ };
+
if (ipt->ipt_ptr - 1 + sizeof(n_time) +
sizeof(struct in_addr) > ipt->ipt_len) {
code = (u_char *)&ipt->ipt_ptr -
@@ -1135,6 +1149,7 @@
pserialize_read_exit(s);
ipt->ipt_ptr += sizeof(struct in_addr);
break;
+ }
default:
/* XXX can't take &ipt->ipt_flg */
Home |
Main Index |
Thread Index |
Old Index