Update TCP CB with new values on rfc1323 and mssdflt sysctl updates

From yasuoka@iij.ad.jp in kern/44254
This commit is contained in:
kefren 2013-12-02 09:39:54 +00:00
parent 2421e2bfaa
commit cbdb038cad

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_usrreq.c,v 1.169 2013/11/23 14:20:21 christos Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.170 2013/12/02 09:39:54 kefren Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -95,7 +95,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.169 2013/11/23 14:20:21 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.170 2013/12/02 09:39:54 kefren Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -1044,9 +1044,42 @@ sysctl_net_inet_tcp_mssdflt(SYSCTLFN_ARGS)
return (EINVAL);
tcp_mssdflt = mssdflt;
mutex_enter(softnet_lock);
tcp_tcpcb_template();
mutex_exit(softnet_lock);
return (0);
}
/*
* sysctl helper for TCP CB template update
*/
static int
sysctl_update_tcpcb_template(SYSCTLFN_ARGS)
{
int t, error;
struct sysctlnode node;
/* follow procedures in sysctl(9) manpage */
t = *(int *)rnode->sysctl_data;
node = *rnode;
node.sysctl_data = &t;
error = sysctl_lookup(SYSCTLFN_CALL(&node));
if (error || newp == NULL)
return error;
if (t < 0)
return EINVAL;
*(int *)rnode->sysctl_data = t;
mutex_enter(softnet_lock);
tcp_tcpcb_template();
mutex_exit(softnet_lock);
return 0;
}
/*
* sysctl helper routine for setting port related values under
* net.inet.ip and net.inet6.ip6. does basic range checking and does
@ -1686,7 +1719,7 @@ sysctl_net_inet_tcp_setup2(struct sysctllog **clog, int pf, const char *pfname,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_INT, "rfc1323",
SYSCTL_DESCR("Enable RFC1323 TCP extensions"),
NULL, 0, &tcp_do_rfc1323, 0,
sysctl_update_tcpcb_template, 0, &tcp_do_rfc1323, 0,
CTL_NET, pf, IPPROTO_TCP, TCPCTL_RFC1323, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
@ -1786,13 +1819,13 @@ sysctl_net_inet_tcp_setup2(struct sysctllog **clog, int pf, const char *pfname,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_INT, "win_scale",
SYSCTL_DESCR("Use RFC1323 window scale options"),
NULL, 0, &tcp_do_win_scale, 0,
sysctl_update_tcpcb_template, 0, &tcp_do_win_scale, 0,
CTL_NET, pf, IPPROTO_TCP, TCPCTL_WSCALE, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_INT, "timestamps",
SYSCTL_DESCR("Use RFC1323 time stamp options"),
NULL, 0, &tcp_do_timestamps, 0,
sysctl_update_tcpcb_template, 0, &tcp_do_timestamps, 0,
CTL_NET, pf, IPPROTO_TCP, TCPCTL_TSTAMP, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,