IP: Cleanups
authorJohn Dykstra <john.dykstra1@gmail.com>
Tue, 20 Oct 2009 04:53:53 +0000 (21:53 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 20 Oct 2009 06:22:52 +0000 (23:22 -0700)
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 <john.dykstra1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ip_sockglue.c
net/ipv4/route.c
net/ipv6/ipv6_sockglue.c

index c602d985fe1456665fb6438156750a2cca2e94c7..2445fedec0b89d5d3f9a321353363b0df11362ad 100644 (file)
@@ -575,7 +575,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
                inet->hdrincl = val ? 1 : 0;
                break;
        case IP_MTU_DISCOVER:
-               if (val < 0 || val > 3)
+               if (val < IP_PMTUDISC_DONT || val > IP_PMTUDISC_PROBE)
                        goto e_inval;
                inet->pmtudisc = val;
                break;
index bb41992520268b08c49f345e2170aeb644c56b7d..68fb22702051feb6a89913b0dcdc310e3bbc37a1 100644 (file)
@@ -1628,9 +1628,6 @@ unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph,
        __be32  daddr = iph->daddr;
        unsigned short est_mtu = 0;
 
-       if (ipv4_config.no_pmtu_disc)
-               return 0;
-
        for (k = 0; k < 2; k++) {
                for (i = 0; i < 2; i++) {
                        unsigned hash = rt_hash(daddr, skeys[i], ikeys[k],
index 39e10ac88019a9a278fcb95357e7130b03ff2821..68566de4bcc5ca78950b4f81f936071a87b8538c 100644 (file)
@@ -662,7 +662,7 @@ done:
        case IPV6_MTU_DISCOVER:
                if (optlen < sizeof(int))
                        goto e_inval;
-               if (val<0 || val>3)
+               if (val < IP_PMTUDISC_DONT || val > IP_PMTUDISC_PROBE)
                        goto e_inval;
                np->pmtudisc = val;
                retv = 0;