mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-23 23:21:46 +00:00
[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>
This commit is contained in:
parent
c6aefafb7e
commit
e898d4db27
14 changed files with 99 additions and 25 deletions
|
@ -400,7 +400,7 @@ static inline int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh,
|
|||
UDP_SKB_CB(skb)->partial_cov = 0;
|
||||
UDP_SKB_CB(skb)->cscov = skb->len;
|
||||
|
||||
if (proto == IPPROTO_UDPLITE) {
|
||||
if (IS_PROTO_UDPLITE(proto)) {
|
||||
err = udplite_checksum_init(skb, uh);
|
||||
if (err)
|
||||
return err;
|
||||
|
@ -489,7 +489,7 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
|
|||
|
||||
if (udp_lib_checksum_complete(skb))
|
||||
goto discard;
|
||||
UDP6_INC_STATS_BH(UDP_MIB_NOPORTS, proto == IPPROTO_UDPLITE);
|
||||
UDP6_INC_STATS_BH(UDP_MIB_NOPORTS, IS_PROTO_UDPLITE(proto));
|
||||
|
||||
icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_PORT_UNREACH, 0, dev);
|
||||
|
||||
|
@ -510,11 +510,11 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
|
|||
|
||||
short_packet:
|
||||
LIMIT_NETDEBUG(KERN_DEBUG "UDP%sv6: short packet: %d/%u\n",
|
||||
proto == IPPROTO_UDPLITE ? "-Lite" : "",
|
||||
IS_PROTO_UDPLITE(proto) ? "-Lite" : "",
|
||||
ulen, skb->len);
|
||||
|
||||
discard:
|
||||
UDP6_INC_STATS_BH(UDP_MIB_INERRORS, proto == IPPROTO_UDPLITE);
|
||||
UDP6_INC_STATS_BH(UDP_MIB_INERRORS, IS_PROTO_UDPLITE(proto));
|
||||
kfree_skb(skb);
|
||||
return 0;
|
||||
}
|
||||
|
@ -890,7 +890,7 @@ int udpv6_destroy_sock(struct sock *sk)
|
|||
int udpv6_setsockopt(struct sock *sk, int level, int optname,
|
||||
char __user *optval, int optlen)
|
||||
{
|
||||
if (level == SOL_UDP || level == SOL_UDPLITE)
|
||||
if (IS_SOL_UDPFAMILY(level))
|
||||
return udp_lib_setsockopt(sk, level, optname, optval, optlen,
|
||||
udp_v6_push_pending_frames);
|
||||
return ipv6_setsockopt(sk, level, optname, optval, optlen);
|
||||
|
@ -900,7 +900,7 @@ int udpv6_setsockopt(struct sock *sk, int level, int optname,
|
|||
int compat_udpv6_setsockopt(struct sock *sk, int level, int optname,
|
||||
char __user *optval, int optlen)
|
||||
{
|
||||
if (level == SOL_UDP || level == SOL_UDPLITE)
|
||||
if (IS_SOL_UDPFAMILY(level))
|
||||
return udp_lib_setsockopt(sk, level, optname, optval, optlen,
|
||||
udp_v6_push_pending_frames);
|
||||
return compat_ipv6_setsockopt(sk, level, optname, optval, optlen);
|
||||
|
@ -910,7 +910,7 @@ int compat_udpv6_setsockopt(struct sock *sk, int level, int optname,
|
|||
int udpv6_getsockopt(struct sock *sk, int level, int optname,
|
||||
char __user *optval, int __user *optlen)
|
||||
{
|
||||
if (level == SOL_UDP || level == SOL_UDPLITE)
|
||||
if (IS_SOL_UDPFAMILY(level))
|
||||
return udp_lib_getsockopt(sk, level, optname, optval, optlen);
|
||||
return ipv6_getsockopt(sk, level, optname, optval, optlen);
|
||||
}
|
||||
|
@ -919,7 +919,7 @@ int udpv6_getsockopt(struct sock *sk, int level, int optname,
|
|||
int compat_udpv6_getsockopt(struct sock *sk, int level, int optname,
|
||||
char __user *optval, int __user *optlen)
|
||||
{
|
||||
if (level == SOL_UDP || level == SOL_UDPLITE)
|
||||
if (IS_SOL_UDPFAMILY(level))
|
||||
return udp_lib_getsockopt(sk, level, optname, optval, optlen);
|
||||
return compat_ipv6_getsockopt(sk, level, optname, optval, optlen);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue