Commit 0eae750e authored by John Dykstra's avatar John Dykstra Committed by David S. Miller

IP: Cleanups

Use symbols instead of magic constants while checking PMTU discovery
setsockopt.

Remove redundant test in ip_rt_frag_needed() (done by caller).
Signed-off-by: default avatarJohn Dykstra <john.dykstra1@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ce5eb7a2
...@@ -575,7 +575,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, ...@@ -575,7 +575,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
inet->hdrincl = val ? 1 : 0; inet->hdrincl = val ? 1 : 0;
break; break;
case IP_MTU_DISCOVER: case IP_MTU_DISCOVER:
if (val < 0 || val > 3) if (val < IP_PMTUDISC_DONT || val > IP_PMTUDISC_PROBE)
goto e_inval; goto e_inval;
inet->pmtudisc = val; inet->pmtudisc = val;
break; break;
......
...@@ -1628,9 +1628,6 @@ unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, ...@@ -1628,9 +1628,6 @@ unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph,
__be32 daddr = iph->daddr; __be32 daddr = iph->daddr;
unsigned short est_mtu = 0; unsigned short est_mtu = 0;
if (ipv4_config.no_pmtu_disc)
return 0;
for (k = 0; k < 2; k++) { for (k = 0; k < 2; k++) {
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
unsigned hash = rt_hash(daddr, skeys[i], ikeys[k], unsigned hash = rt_hash(daddr, skeys[i], ikeys[k],
......
...@@ -662,7 +662,7 @@ done: ...@@ -662,7 +662,7 @@ done:
case IPV6_MTU_DISCOVER: case IPV6_MTU_DISCOVER:
if (optlen < sizeof(int)) if (optlen < sizeof(int))
goto e_inval; goto e_inval;
if (val<0 || val>3) if (val < IP_PMTUDISC_DONT || val > IP_PMTUDISC_PROBE)
goto e_inval; goto e_inval;
np->pmtudisc = val; np->pmtudisc = val;
retv = 0; retv = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment