diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2013-10-21 12:27:17 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2013-10-21 12:27:17 +0000 |
commit | 5d4a381e3b9cfa18348947cea694a4b2719da438 (patch) | |
tree | 1468a60d4da9088f78bcd3f6492643bcc23ec51e | |
parent | a6be094cde992072567c10146b1caffc51c4623c (diff) |
There are gasps of shock! Add a pmtu delay sysctl BUTTON for netinet6,
making the code the same as netinet4 along the way.
ok bluhm phessler
-rw-r--r-- | sys/netinet/ip_icmp.c | 11 | ||||
-rw-r--r-- | sys/netinet/ip_input.c | 4 | ||||
-rw-r--r-- | sys/netinet/ip_var.h | 4 | ||||
-rw-r--r-- | sys/netinet6/icmp6.c | 20 | ||||
-rw-r--r-- | sys/netinet6/in6.h | 7 | ||||
-rw-r--r-- | sys/netinet6/in6_proto.c | 11 | ||||
-rw-r--r-- | sys/netinet6/ip6_input.c | 13 | ||||
-rw-r--r-- | sys/netinet6/ip6_var.h | 5 |
8 files changed, 37 insertions, 38 deletions
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c index d34fc1eaeb5..65281ab8764 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_icmp.c,v 1.107 2013/10/20 11:03:01 phessler Exp $ */ +/* $OpenBSD: ip_icmp.c,v 1.108 2013/10/21 12:27:11 deraadt Exp $ */ /* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */ /* @@ -1073,14 +1073,11 @@ icmp_mtudisc_timeout(struct rtentry *rt, struct rttimer *r) int icmp_ratelimit(const struct in_addr *dst, const int type, const int code) { - /* PPS limit */ if (!ppsratecheck(&icmperrppslim_last, &icmperrpps_count, icmperrppslim)) - return 1; - - /*okay to send*/ - return 0; + return 1; /* The packet is subject to rate limit */ + return 0; /* okay to send */ } void @@ -1128,7 +1125,7 @@ icmp_do_exthdr(struct mbuf *m, u_int16_t class, u_int8_t ctype, void *buf, /* exthdr already present, giving up */ return (0); - /* the actuall offset starts after the common ICMP header */ + /* the actual offset starts after the common ICMP header */ hlen += ICMP_MINLEN; /* exthdr must start on a word boundary */ off = roundup(ntohs(ip->ip_len) - hlen, sizeof(u_int32_t)); diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index daf90221419..497b4403a0d 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_input.c,v 1.217 2013/08/21 09:02:12 mpi Exp $ */ +/* $OpenBSD: ip_input.c,v 1.218 2013/10/21 12:27:12 deraadt Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* @@ -76,8 +76,6 @@ #include <netinet/ip_carp.h> #endif -#define IPMTUDISCTIMEOUT (10 * 60) /* as per RFC 1191 */ - struct ipqhead ipq; int encdebug = 0; diff --git a/sys/netinet/ip_var.h b/sys/netinet/ip_var.h index c111109cfd8..098c8b4e46d 100644 --- a/sys/netinet/ip_var.h +++ b/sys/netinet/ip_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_var.h,v 1.46 2013/08/13 09:52:53 mpi Exp $ */ +/* $OpenBSD: ip_var.h,v 1.47 2013/10/21 12:27:13 deraadt Exp $ */ /* $NetBSD: ip_var.h,v 1.16 1996/02/13 23:43:20 christos Exp $ */ /* @@ -152,6 +152,8 @@ extern int ip_defttl; /* default IP ttl */ extern struct socket *ip_mrouter; /* multicast routing daemon */ #endif +#define IPMTUDISCTIMEOUT (10 * 60) /* as per RFC 1191 */ + extern int ip_mtudisc; /* mtu discovery */ extern u_int ip_mtudisc_timeout; /* seconds to timeout mtu discovery */ diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 03434510f91..71c8abb8868 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: icmp6.c,v 1.132 2013/10/21 08:42:25 phessler Exp $ */ +/* $OpenBSD: icmp6.c,v 1.133 2013/10/21 12:27:14 deraadt Exp $ */ /* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */ /* @@ -148,8 +148,7 @@ struct icmp6_mtudisc_callback { LIST_HEAD(, icmp6_mtudisc_callback) icmp6_mtudisc_callbacks = LIST_HEAD_INITIALIZER(icmp6_mtudisc_callbacks); -static struct rttimer_queue *icmp6_mtudisc_timeout_q = NULL; -extern int pmtu_expire; +struct rttimer_queue *icmp6_mtudisc_timeout_q = NULL; /* XXX do these values make any sense? */ static int icmp6_mtudisc_hiwat = 1280; @@ -184,7 +183,7 @@ void icmp6_init(void) { mld6_init(); - icmp6_mtudisc_timeout_q = rt_timer_queue_create(pmtu_expire); + icmp6_mtudisc_timeout_q = rt_timer_queue_create(ip6_mtudisc_timeout); icmp6_redirect_timeout_q = rt_timer_queue_create(icmp6_redirtimeout); } @@ -2744,18 +2743,11 @@ icmp6_ctloutput(int op, struct socket *so, int level, int optname, int icmp6_ratelimit(const struct in6_addr *dst, const int type, const int code) { - int ret; - - ret = 0; /* okay to send */ - /* PPS limit */ if (!ppsratecheck(&icmp6errppslim_last, &icmp6errpps_count, - icmp6errppslim)) { - /* The packet is subject to rate limit */ - ret++; - } - - return ret; + icmp6errppslim)) + return 1; /* The packet is subject to rate limit */ + return 0; /* okay to send */ } struct rtentry * diff --git a/sys/netinet6/in6.h b/sys/netinet6/in6.h index 6468dbe1ba9..94e3cdf9070 100644 --- a/sys/netinet6/in6.h +++ b/sys/netinet6/in6.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.h,v 1.65 2013/06/26 09:12:40 henning Exp $ */ +/* $OpenBSD: in6.h,v 1.66 2013/10/21 12:27:15 deraadt Exp $ */ /* $KAME: in6.h,v 1.83 2001/03/29 02:55:07 jinmei Exp $ */ /* @@ -640,7 +640,8 @@ struct ip6_mtuinfo { #define IPV6CTL_MAXIFDEFROUTERS 47 #define IPV6CTL_MAXDYNROUTES 48 #define IPV6CTL_DAD_PENDING 49 -#define IPV6CTL_MAXID 50 +#define IPV6CTL_MTUDISCTIMEOUT 50 +#define IPV6CTL_MAXID 51 /* New entries should be added here from current IPV6CTL_MAXID value. */ /* to define items, should talk with KAME guys first, for *BSD compatibility */ @@ -696,6 +697,7 @@ struct ip6_mtuinfo { { "maxifdefrouters", CTLTYPE_INT }, \ { "maxdynroutes", CTLTYPE_INT }, \ { "dad_pending", CTLTYPE_INT }, \ + { "mtudisctimeout", CTLTYPE_INT }, \ } #define IPV6CTL_VARS { \ @@ -749,6 +751,7 @@ struct ip6_mtuinfo { &ip6_maxifdefrouters, \ &ip6_maxdynroutes, \ NULL, \ + NULL, \ } #endif /* __BSD_VISIBLE */ diff --git a/sys/netinet6/in6_proto.c b/sys/netinet6/in6_proto.c index c59660c9479..e15f90caccb 100644 --- a/sys/netinet6/in6_proto.c +++ b/sys/netinet6/in6_proto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_proto.c,v 1.68 2013/10/17 16:27:45 bluhm Exp $ */ +/* $OpenBSD: in6_proto.c,v 1.69 2013/10/21 12:27:15 deraadt Exp $ */ /* $KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $ */ /* @@ -294,14 +294,6 @@ int ip6_maxifdefrouters = 16; /* Max acceptable def routers via RA */ int ip6_maxdynroutes = 4096; /* Max # of routes created via redirect */ time_t ip6_log_time = (time_t)0L; -/* icmp6 */ -/* - * BSDI4 defines these variables in in_proto.c... - * XXX: what if we don't define INET? Should we define pmtu6_expire - * or so? (jinmei@kame.net 19990310) - */ -int pmtu_expire = 60*10; - /* raw IP6 parameters */ /* * Nominal space allocated to a raw ip socket. @@ -317,3 +309,4 @@ int icmp6_rediraccept = 0; /* don't process redirects by default */ int icmp6_redirtimeout = 10 * 60; /* 10 minutes */ int icmp6errppslim = 100; /* 100pps */ int icmp6_nodeinfo = 1; /* enable/disable NI response */ +int ip6_mtudisc_timeout = IPMTUDISCTIMEOUT; diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index d8915befeb9..3ed6bd301b9 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_input.c,v 1.116 2013/10/19 21:25:15 bluhm Exp $ */ +/* $OpenBSD: ip6_input.c,v 1.117 2013/10/21 12:27:16 deraadt Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -1358,6 +1358,7 @@ ip6_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, extern int ip6_mrtproto; extern struct mrt6stat mrt6stat; #endif + int error, s; /* All sysctl names at this level are terminal. */ if (namelen != 1) @@ -1390,6 +1391,16 @@ ip6_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, #else return (EOPNOTSUPP); #endif + case IPV6CTL_MTUDISCTIMEOUT: + error = sysctl_int(oldp, oldlenp, newp, newlen, + &ip6_mtudisc_timeout); + if (icmp6_mtudisc_timeout_q != NULL) { + s = splsoftnet(); + rt_timer_queue_change(icmp6_mtudisc_timeout_q, + ip6_mtudisc_timeout); + splx(s); + } + return (error); default: if (name[0] < IPV6CTL_MAXID) return (sysctl_int_arr(ipv6ctl_vars, name, namelen, diff --git a/sys/netinet6/ip6_var.h b/sys/netinet6/ip6_var.h index d464e29fc3e..04d43031e48 100644 --- a/sys/netinet6/ip6_var.h +++ b/sys/netinet6/ip6_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_var.h,v 1.46 2013/06/01 16:22:05 bluhm Exp $ */ +/* $OpenBSD: ip6_var.h,v 1.47 2013/10/21 12:27:16 deraadt Exp $ */ /* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */ /* @@ -219,6 +219,9 @@ struct ip6stat { #define IPV6_FORWARDING 0x02 /* most of IPv6 header exists */ #define IPV6_MINMTU 0x04 /* use minimum MTU (IPV6_USE_MIN_MTU) */ +extern int ip6_mtudisc_timeout; /* mtu discovery */ +extern struct rttimer_queue *icmp6_mtudisc_timeout_q; + extern struct ip6stat ip6stat; /* statistics */ extern int ip6_defhlim; /* default hop limit */ extern int ip6_defmcasthlim; /* default multicast hop limit */ |