[NETFILTER]: Fix timeout sysctls on big-endian 64bit architectures

The connection tracking timeout variables are unsigned long, but
proc_dointvec_jiffies is used with sizeof(unsigned int) in the sysctl
tables. Since there is no proc_doulongvec_jiffies function, change the
timeout variables to unsigned int.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Patrick McHardy and committed by
David S. Miller
babbdb1a 9d28026b

+71 -71
+1 -1
net/ipv4/netfilter/ip_conntrack_proto_generic.c
··· 12 12 #include <linux/netfilter.h> 13 13 #include <linux/netfilter_ipv4/ip_conntrack_protocol.h> 14 14 15 - unsigned long ip_ct_generic_timeout = 600*HZ; 15 + unsigned int ip_ct_generic_timeout = 600*HZ; 16 16 17 17 static int generic_pkt_to_tuple(const struct sk_buff *skb, 18 18 unsigned int dataoff,
+1 -1
net/ipv4/netfilter/ip_conntrack_proto_icmp.c
··· 22 22 #include <linux/netfilter_ipv4/ip_conntrack_core.h> 23 23 #include <linux/netfilter_ipv4/ip_conntrack_protocol.h> 24 24 25 - unsigned long ip_ct_icmp_timeout = 30*HZ; 25 + unsigned int ip_ct_icmp_timeout = 30*HZ; 26 26 27 27 #if 0 28 28 #define DEBUGP printk
+8 -8
net/ipv4/netfilter/ip_conntrack_proto_sctp.c
··· 58 58 #define HOURS * 60 MINS 59 59 #define DAYS * 24 HOURS 60 60 61 - static unsigned long ip_ct_sctp_timeout_closed = 10 SECS; 62 - static unsigned long ip_ct_sctp_timeout_cookie_wait = 3 SECS; 63 - static unsigned long ip_ct_sctp_timeout_cookie_echoed = 3 SECS; 64 - static unsigned long ip_ct_sctp_timeout_established = 5 DAYS; 65 - static unsigned long ip_ct_sctp_timeout_shutdown_sent = 300 SECS / 1000; 66 - static unsigned long ip_ct_sctp_timeout_shutdown_recd = 300 SECS / 1000; 67 - static unsigned long ip_ct_sctp_timeout_shutdown_ack_sent = 3 SECS; 61 + static unsigned int ip_ct_sctp_timeout_closed = 10 SECS; 62 + static unsigned int ip_ct_sctp_timeout_cookie_wait = 3 SECS; 63 + static unsigned int ip_ct_sctp_timeout_cookie_echoed = 3 SECS; 64 + static unsigned int ip_ct_sctp_timeout_established = 5 DAYS; 65 + static unsigned int ip_ct_sctp_timeout_shutdown_sent = 300 SECS / 1000; 66 + static unsigned int ip_ct_sctp_timeout_shutdown_recd = 300 SECS / 1000; 67 + static unsigned int ip_ct_sctp_timeout_shutdown_ack_sent = 3 SECS; 68 68 69 - static const unsigned long * sctp_timeouts[] 69 + static const unsigned int * sctp_timeouts[] 70 70 = { NULL, /* SCTP_CONNTRACK_NONE */ 71 71 &ip_ct_sctp_timeout_closed, /* SCTP_CONNTRACK_CLOSED */ 72 72 &ip_ct_sctp_timeout_cookie_wait, /* SCTP_CONNTRACK_COOKIE_WAIT */
+10 -10
net/ipv4/netfilter/ip_conntrack_proto_tcp.c
··· 85 85 #define HOURS * 60 MINS 86 86 #define DAYS * 24 HOURS 87 87 88 - unsigned long ip_ct_tcp_timeout_syn_sent = 2 MINS; 89 - unsigned long ip_ct_tcp_timeout_syn_recv = 60 SECS; 90 - unsigned long ip_ct_tcp_timeout_established = 5 DAYS; 91 - unsigned long ip_ct_tcp_timeout_fin_wait = 2 MINS; 92 - unsigned long ip_ct_tcp_timeout_close_wait = 60 SECS; 93 - unsigned long ip_ct_tcp_timeout_last_ack = 30 SECS; 94 - unsigned long ip_ct_tcp_timeout_time_wait = 2 MINS; 95 - unsigned long ip_ct_tcp_timeout_close = 10 SECS; 88 + unsigned int ip_ct_tcp_timeout_syn_sent = 2 MINS; 89 + unsigned int ip_ct_tcp_timeout_syn_recv = 60 SECS; 90 + unsigned int ip_ct_tcp_timeout_established = 5 DAYS; 91 + unsigned int ip_ct_tcp_timeout_fin_wait = 2 MINS; 92 + unsigned int ip_ct_tcp_timeout_close_wait = 60 SECS; 93 + unsigned int ip_ct_tcp_timeout_last_ack = 30 SECS; 94 + unsigned int ip_ct_tcp_timeout_time_wait = 2 MINS; 95 + unsigned int ip_ct_tcp_timeout_close = 10 SECS; 96 96 97 97 /* RFC1122 says the R2 limit should be at least 100 seconds. 98 98 Linux uses 15 packets as limit, which corresponds 99 99 to ~13-30min depending on RTO. */ 100 - unsigned long ip_ct_tcp_timeout_max_retrans = 5 MINS; 100 + unsigned int ip_ct_tcp_timeout_max_retrans = 5 MINS; 101 101 102 - static const unsigned long * tcp_timeouts[] 102 + static const unsigned int * tcp_timeouts[] 103 103 = { NULL, /* TCP_CONNTRACK_NONE */ 104 104 &ip_ct_tcp_timeout_syn_sent, /* TCP_CONNTRACK_SYN_SENT, */ 105 105 &ip_ct_tcp_timeout_syn_recv, /* TCP_CONNTRACK_SYN_RECV, */
+2 -2
net/ipv4/netfilter/ip_conntrack_proto_udp.c
··· 19 19 #include <linux/netfilter_ipv4.h> 20 20 #include <linux/netfilter_ipv4/ip_conntrack_protocol.h> 21 21 22 - unsigned long ip_ct_udp_timeout = 30*HZ; 23 - unsigned long ip_ct_udp_timeout_stream = 180*HZ; 22 + unsigned int ip_ct_udp_timeout = 30*HZ; 23 + unsigned int ip_ct_udp_timeout_stream = 180*HZ; 24 24 25 25 static int udp_pkt_to_tuple(const struct sk_buff *skb, 26 26 unsigned int dataoff,
+13 -13
net/ipv4/netfilter/ip_conntrack_standalone.c
··· 544 544 extern unsigned int ip_conntrack_htable_size; 545 545 546 546 /* From ip_conntrack_proto_tcp.c */ 547 - extern unsigned long ip_ct_tcp_timeout_syn_sent; 548 - extern unsigned long ip_ct_tcp_timeout_syn_recv; 549 - extern unsigned long ip_ct_tcp_timeout_established; 550 - extern unsigned long ip_ct_tcp_timeout_fin_wait; 551 - extern unsigned long ip_ct_tcp_timeout_close_wait; 552 - extern unsigned long ip_ct_tcp_timeout_last_ack; 553 - extern unsigned long ip_ct_tcp_timeout_time_wait; 554 - extern unsigned long ip_ct_tcp_timeout_close; 555 - extern unsigned long ip_ct_tcp_timeout_max_retrans; 547 + extern unsigned int ip_ct_tcp_timeout_syn_sent; 548 + extern unsigned int ip_ct_tcp_timeout_syn_recv; 549 + extern unsigned int ip_ct_tcp_timeout_established; 550 + extern unsigned int ip_ct_tcp_timeout_fin_wait; 551 + extern unsigned int ip_ct_tcp_timeout_close_wait; 552 + extern unsigned int ip_ct_tcp_timeout_last_ack; 553 + extern unsigned int ip_ct_tcp_timeout_time_wait; 554 + extern unsigned int ip_ct_tcp_timeout_close; 555 + extern unsigned int ip_ct_tcp_timeout_max_retrans; 556 556 extern int ip_ct_tcp_loose; 557 557 extern int ip_ct_tcp_be_liberal; 558 558 extern int ip_ct_tcp_max_retrans; 559 559 560 560 /* From ip_conntrack_proto_udp.c */ 561 - extern unsigned long ip_ct_udp_timeout; 562 - extern unsigned long ip_ct_udp_timeout_stream; 561 + extern unsigned int ip_ct_udp_timeout; 562 + extern unsigned int ip_ct_udp_timeout_stream; 563 563 564 564 /* From ip_conntrack_proto_icmp.c */ 565 - extern unsigned long ip_ct_icmp_timeout; 565 + extern unsigned int ip_ct_icmp_timeout; 566 566 567 567 /* From ip_conntrack_proto_icmp.c */ 568 - extern unsigned long ip_ct_generic_timeout; 568 + extern unsigned int ip_ct_generic_timeout; 569 569 570 570 /* Log invalid packets of a given protocol */ 571 571 static int log_invalid_proto_min = 0;
+1 -1
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
··· 277 277 278 278 #ifdef CONFIG_SYSCTL 279 279 /* From nf_conntrack_proto_icmp.c */ 280 - extern unsigned long nf_ct_icmp_timeout; 280 + extern unsigned int nf_ct_icmp_timeout; 281 281 static struct ctl_table_header *nf_ct_ipv4_sysctl_header; 282 282 283 283 static ctl_table nf_ct_sysctl_table[] = {
+2 -2
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
··· 335 335 #ifdef CONFIG_SYSCTL 336 336 337 337 /* From nf_conntrack_proto_icmpv6.c */ 338 - extern unsigned long nf_ct_icmpv6_timeout; 338 + extern unsigned int nf_ct_icmpv6_timeout; 339 339 340 340 /* From nf_conntrack_frag6.c */ 341 - extern unsigned long nf_ct_frag6_timeout; 341 + extern unsigned int nf_ct_frag6_timeout; 342 342 extern unsigned int nf_ct_frag6_low_thresh; 343 343 extern unsigned int nf_ct_frag6_high_thresh; 344 344
+1 -1
net/netfilter/nf_conntrack_proto_generic.c
··· 17 17 #include <linux/netfilter.h> 18 18 #include <net/netfilter/nf_conntrack_protocol.h> 19 19 20 - unsigned long nf_ct_generic_timeout = 600*HZ; 20 + unsigned int nf_ct_generic_timeout = 600*HZ; 21 21 22 22 static int generic_pkt_to_tuple(const struct sk_buff *skb, 23 23 unsigned int dataoff,
+8 -8
net/netfilter/nf_conntrack_proto_sctp.c
··· 62 62 #define HOURS * 60 MINS 63 63 #define DAYS * 24 HOURS 64 64 65 - static unsigned long nf_ct_sctp_timeout_closed = 10 SECS; 66 - static unsigned long nf_ct_sctp_timeout_cookie_wait = 3 SECS; 67 - static unsigned long nf_ct_sctp_timeout_cookie_echoed = 3 SECS; 68 - static unsigned long nf_ct_sctp_timeout_established = 5 DAYS; 69 - static unsigned long nf_ct_sctp_timeout_shutdown_sent = 300 SECS / 1000; 70 - static unsigned long nf_ct_sctp_timeout_shutdown_recd = 300 SECS / 1000; 71 - static unsigned long nf_ct_sctp_timeout_shutdown_ack_sent = 3 SECS; 65 + static unsigned int nf_ct_sctp_timeout_closed = 10 SECS; 66 + static unsigned int nf_ct_sctp_timeout_cookie_wait = 3 SECS; 67 + static unsigned int nf_ct_sctp_timeout_cookie_echoed = 3 SECS; 68 + static unsigned int nf_ct_sctp_timeout_established = 5 DAYS; 69 + static unsigned int nf_ct_sctp_timeout_shutdown_sent = 300 SECS / 1000; 70 + static unsigned int nf_ct_sctp_timeout_shutdown_recd = 300 SECS / 1000; 71 + static unsigned int nf_ct_sctp_timeout_shutdown_ack_sent = 3 SECS; 72 72 73 - static unsigned long * sctp_timeouts[] 73 + static unsigned int * sctp_timeouts[] 74 74 = { NULL, /* SCTP_CONNTRACK_NONE */ 75 75 &nf_ct_sctp_timeout_closed, /* SCTP_CONNTRACK_CLOSED */ 76 76 &nf_ct_sctp_timeout_cookie_wait, /* SCTP_CONNTRACK_COOKIE_WAIT */
+10 -10
net/netfilter/nf_conntrack_proto_tcp.c
··· 93 93 #define HOURS * 60 MINS 94 94 #define DAYS * 24 HOURS 95 95 96 - unsigned long nf_ct_tcp_timeout_syn_sent = 2 MINS; 97 - unsigned long nf_ct_tcp_timeout_syn_recv = 60 SECS; 98 - unsigned long nf_ct_tcp_timeout_established = 5 DAYS; 99 - unsigned long nf_ct_tcp_timeout_fin_wait = 2 MINS; 100 - unsigned long nf_ct_tcp_timeout_close_wait = 60 SECS; 101 - unsigned long nf_ct_tcp_timeout_last_ack = 30 SECS; 102 - unsigned long nf_ct_tcp_timeout_time_wait = 2 MINS; 103 - unsigned long nf_ct_tcp_timeout_close = 10 SECS; 96 + unsigned int nf_ct_tcp_timeout_syn_sent = 2 MINS; 97 + unsigned int nf_ct_tcp_timeout_syn_recv = 60 SECS; 98 + unsigned int nf_ct_tcp_timeout_established = 5 DAYS; 99 + unsigned int nf_ct_tcp_timeout_fin_wait = 2 MINS; 100 + unsigned int nf_ct_tcp_timeout_close_wait = 60 SECS; 101 + unsigned int nf_ct_tcp_timeout_last_ack = 30 SECS; 102 + unsigned int nf_ct_tcp_timeout_time_wait = 2 MINS; 103 + unsigned int nf_ct_tcp_timeout_close = 10 SECS; 104 104 105 105 /* RFC1122 says the R2 limit should be at least 100 seconds. 106 106 Linux uses 15 packets as limit, which corresponds 107 107 to ~13-30min depending on RTO. */ 108 - unsigned long nf_ct_tcp_timeout_max_retrans = 5 MINS; 108 + unsigned int nf_ct_tcp_timeout_max_retrans = 5 MINS; 109 109 110 - static unsigned long * tcp_timeouts[] 110 + static unsigned int * tcp_timeouts[] 111 111 = { NULL, /* TCP_CONNTRACK_NONE */ 112 112 &nf_ct_tcp_timeout_syn_sent, /* TCP_CONNTRACK_SYN_SENT, */ 113 113 &nf_ct_tcp_timeout_syn_recv, /* TCP_CONNTRACK_SYN_RECV, */
+2 -2
net/netfilter/nf_conntrack_proto_udp.c
··· 27 27 #include <linux/netfilter_ipv6.h> 28 28 #include <net/netfilter/nf_conntrack_protocol.h> 29 29 30 - unsigned long nf_ct_udp_timeout = 30*HZ; 31 - unsigned long nf_ct_udp_timeout_stream = 180*HZ; 30 + unsigned int nf_ct_udp_timeout = 30*HZ; 31 + unsigned int nf_ct_udp_timeout_stream = 180*HZ; 32 32 33 33 static int udp_pkt_to_tuple(const struct sk_buff *skb, 34 34 unsigned int dataoff,
+12 -12
net/netfilter/nf_conntrack_standalone.c
··· 431 431 extern unsigned int nf_conntrack_htable_size; 432 432 433 433 /* From nf_conntrack_proto_tcp.c */ 434 - extern unsigned long nf_ct_tcp_timeout_syn_sent; 435 - extern unsigned long nf_ct_tcp_timeout_syn_recv; 436 - extern unsigned long nf_ct_tcp_timeout_established; 437 - extern unsigned long nf_ct_tcp_timeout_fin_wait; 438 - extern unsigned long nf_ct_tcp_timeout_close_wait; 439 - extern unsigned long nf_ct_tcp_timeout_last_ack; 440 - extern unsigned long nf_ct_tcp_timeout_time_wait; 441 - extern unsigned long nf_ct_tcp_timeout_close; 442 - extern unsigned long nf_ct_tcp_timeout_max_retrans; 434 + extern unsigned int nf_ct_tcp_timeout_syn_sent; 435 + extern unsigned int nf_ct_tcp_timeout_syn_recv; 436 + extern unsigned int nf_ct_tcp_timeout_established; 437 + extern unsigned int nf_ct_tcp_timeout_fin_wait; 438 + extern unsigned int nf_ct_tcp_timeout_close_wait; 439 + extern unsigned int nf_ct_tcp_timeout_last_ack; 440 + extern unsigned int nf_ct_tcp_timeout_time_wait; 441 + extern unsigned int nf_ct_tcp_timeout_close; 442 + extern unsigned int nf_ct_tcp_timeout_max_retrans; 443 443 extern int nf_ct_tcp_loose; 444 444 extern int nf_ct_tcp_be_liberal; 445 445 extern int nf_ct_tcp_max_retrans; 446 446 447 447 /* From nf_conntrack_proto_udp.c */ 448 - extern unsigned long nf_ct_udp_timeout; 449 - extern unsigned long nf_ct_udp_timeout_stream; 448 + extern unsigned int nf_ct_udp_timeout; 449 + extern unsigned int nf_ct_udp_timeout_stream; 450 450 451 451 /* From nf_conntrack_proto_generic.c */ 452 - extern unsigned long nf_ct_generic_timeout; 452 + extern unsigned int nf_ct_generic_timeout; 453 453 454 454 /* Log invalid packets of a given protocol */ 455 455 static int log_invalid_proto_min = 0;