Skip to content

Commit 0eae750

Browse files
jdykstradavem330
authored andcommitted
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: John Dykstra <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ce5eb7a commit 0eae750

File tree

3 files changed

+2
-5
lines changed

3 files changed

+2
-5
lines changed

net/ipv4/ip_sockglue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
575575
inet->hdrincl = val ? 1 : 0;
576576
break;
577577
case IP_MTU_DISCOVER:
578-
if (val < 0 || val > 3)
578+
if (val < IP_PMTUDISC_DONT || val > IP_PMTUDISC_PROBE)
579579
goto e_inval;
580580
inet->pmtudisc = val;
581581
break;

net/ipv4/route.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,9 +1628,6 @@ unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph,
16281628
__be32 daddr = iph->daddr;
16291629
unsigned short est_mtu = 0;
16301630

1631-
if (ipv4_config.no_pmtu_disc)
1632-
return 0;
1633-
16341631
for (k = 0; k < 2; k++) {
16351632
for (i = 0; i < 2; i++) {
16361633
unsigned hash = rt_hash(daddr, skeys[i], ikeys[k],

net/ipv6/ipv6_sockglue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
662662
case IPV6_MTU_DISCOVER:
663663
if (optlen < sizeof(int))
664664
goto e_inval;
665-
if (val<0 || val>3)
665+
if (val < IP_PMTUDISC_DONT || val > IP_PMTUDISC_PROBE)
666666
goto e_inval;
667667
np->pmtudisc = val;
668668
retv = 0;

0 commit comments

Comments
 (0)