Commit 249fab773dd5f689318c969ed649c4db077cdfc3

Authored by Eric Dumazet
Committed by David S. Miller
1 parent 8c4877a412

net: add limits to ip_default_ttl

ip_default_ttl should be between 1 and 255

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 5 additions and 2 deletions Side-by-side Diff

net/ipv4/sysctl_net_ipv4.c
... ... @@ -28,6 +28,8 @@
28 28 static int ip_local_port_range_max[] = { 65535, 65535 };
29 29 static int tcp_adv_win_scale_min = -31;
30 30 static int tcp_adv_win_scale_max = 31;
  31 +static int ip_ttl_min = 1;
  32 +static int ip_ttl_max = 255;
31 33  
32 34 /* Update system visible IP port range */
33 35 static void set_local_port_range(int range[2])
... ... @@ -155,8 +157,9 @@
155 157 .data = &sysctl_ip_default_ttl,
156 158 .maxlen = sizeof(int),
157 159 .mode = 0644,
158   - .proc_handler = proc_dointvec,
159   - .extra2 = &init_net,
  160 + .proc_handler = proc_dointvec_minmax,
  161 + .extra1 = &ip_ttl_min,
  162 + .extra2 = &ip_ttl_max,
160 163 },
161 164 {
162 165 .procname = "ip_no_pmtu_disc",