aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/udp.c
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-02-29 11:06:47 -0500
committerYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-03-04 01:18:22 -0500
commite898d4db2749c6052072e9bc4448e396cbdeb06a (patch)
tree2b8673d85210a23e67d0817b18f401411e8936f3 /net/ipv6/udp.c
parentc6aefafb7ec620911d46174eed514f9df639e5a4 (diff)
[UDP]: Allow users to configure UDP-Lite.
Let's give users an option for disabling UDP-Lite (~4K). old: | text data bss dec hex filename | 286498 12432 6072 305002 4a76a net/ipv4/built-in.o | 193830 8192 3204 205226 321aa net/ipv6/ipv6.o new (without UDP-Lite): | text data bss dec hex filename | 284086 12136 5432 301654 49a56 net/ipv4/built-in.o | 191835 7832 3076 202743 317f7 net/ipv6/ipv6.o Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Diffstat (limited to 'net/ipv6/udp.c')
-rw-r--r--net/ipv6/udp.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 53739de829db..55feac7ba717 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -400,7 +400,7 @@ static inline int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh,
400 UDP_SKB_CB(skb)->partial_cov = 0; 400 UDP_SKB_CB(skb)->partial_cov = 0;
401 UDP_SKB_CB(skb)->cscov = skb->len; 401 UDP_SKB_CB(skb)->cscov = skb->len;
402 402
403 if (proto == IPPROTO_UDPLITE) { 403 if (IS_PROTO_UDPLITE(proto)) {
404 err = udplite_checksum_init(skb, uh); 404 err = udplite_checksum_init(skb, uh);
405 if (err) 405 if (err)
406 return err; 406 return err;
@@ -489,7 +489,7 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
489 489
490 if (udp_lib_checksum_complete(skb)) 490 if (udp_lib_checksum_complete(skb))
491 goto discard; 491 goto discard;
492 UDP6_INC_STATS_BH(UDP_MIB_NOPORTS, proto == IPPROTO_UDPLITE); 492 UDP6_INC_STATS_BH(UDP_MIB_NOPORTS, IS_PROTO_UDPLITE(proto));
493 493
494 icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_PORT_UNREACH, 0, dev); 494 icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_PORT_UNREACH, 0, dev);
495 495
@@ -510,11 +510,11 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
510 510
511short_packet: 511short_packet:
512 LIMIT_NETDEBUG(KERN_DEBUG "UDP%sv6: short packet: %d/%u\n", 512 LIMIT_NETDEBUG(KERN_DEBUG "UDP%sv6: short packet: %d/%u\n",
513 proto == IPPROTO_UDPLITE ? "-Lite" : "", 513 IS_PROTO_UDPLITE(proto) ? "-Lite" : "",
514 ulen, skb->len); 514 ulen, skb->len);
515 515
516discard: 516discard:
517 UDP6_INC_STATS_BH(UDP_MIB_INERRORS, proto == IPPROTO_UDPLITE); 517 UDP6_INC_STATS_BH(UDP_MIB_INERRORS, IS_PROTO_UDPLITE(proto));
518 kfree_skb(skb); 518 kfree_skb(skb);
519 return 0; 519 return 0;
520} 520}
@@ -890,7 +890,7 @@ int udpv6_destroy_sock(struct sock *sk)
890int udpv6_setsockopt(struct sock *sk, int level, int optname, 890int udpv6_setsockopt(struct sock *sk, int level, int optname,
891 char __user *optval, int optlen) 891 char __user *optval, int optlen)
892{ 892{
893 if (level == SOL_UDP || level == SOL_UDPLITE) 893 if (IS_SOL_UDPFAMILY(level))
894 return udp_lib_setsockopt(sk, level, optname, optval, optlen, 894 return udp_lib_setsockopt(sk, level, optname, optval, optlen,
895 udp_v6_push_pending_frames); 895 udp_v6_push_pending_frames);
896 return ipv6_setsockopt(sk, level, optname, optval, optlen); 896 return ipv6_setsockopt(sk, level, optname, optval, optlen);
@@ -900,7 +900,7 @@ int udpv6_setsockopt(struct sock *sk, int level, int optname,
900int compat_udpv6_setsockopt(struct sock *sk, int level, int optname, 900int compat_udpv6_setsockopt(struct sock *sk, int level, int optname,
901 char __user *optval, int optlen) 901 char __user *optval, int optlen)
902{ 902{
903 if (level == SOL_UDP || level == SOL_UDPLITE) 903 if (IS_SOL_UDPFAMILY(level))
904 return udp_lib_setsockopt(sk, level, optname, optval, optlen, 904 return udp_lib_setsockopt(sk, level, optname, optval, optlen,
905 udp_v6_push_pending_frames); 905 udp_v6_push_pending_frames);
906 return compat_ipv6_setsockopt(sk, level, optname, optval, optlen); 906 return compat_ipv6_setsockopt(sk, level, optname, optval, optlen);
@@ -910,7 +910,7 @@ int compat_udpv6_setsockopt(struct sock *sk, int level, int optname,
910int udpv6_getsockopt(struct sock *sk, int level, int optname, 910int udpv6_getsockopt(struct sock *sk, int level, int optname,
911 char __user *optval, int __user *optlen) 911 char __user *optval, int __user *optlen)
912{ 912{
913 if (level == SOL_UDP || level == SOL_UDPLITE) 913 if (IS_SOL_UDPFAMILY(level))
914 return udp_lib_getsockopt(sk, level, optname, optval, optlen); 914 return udp_lib_getsockopt(sk, level, optname, optval, optlen);
915 return ipv6_getsockopt(sk, level, optname, optval, optlen); 915 return ipv6_getsockopt(sk, level, optname, optval, optlen);
916} 916}
@@ -919,7 +919,7 @@ int udpv6_getsockopt(struct sock *sk, int level, int optname,
919int compat_udpv6_getsockopt(struct sock *sk, int level, int optname, 919int compat_udpv6_getsockopt(struct sock *sk, int level, int optname,
920 char __user *optval, int __user *optlen) 920 char __user *optval, int __user *optlen)
921{ 921{
922 if (level == SOL_UDP || level == SOL_UDPLITE) 922 if (IS_SOL_UDPFAMILY(level))
923 return udp_lib_getsockopt(sk, level, optname, optval, optlen); 923 return udp_lib_getsockopt(sk, level, optname, optval, optlen);
924 return compat_ipv6_getsockopt(sk, level, optname, optval, optlen); 924 return compat_ipv6_getsockopt(sk, level, optname, optval, optlen);
925} 925}