: UDP-Lite support
Subsystems (7)
PATCH 1/2 : UDP-Lite support
[UDPv4]: Support for UDP-Litev4 (RFC 3828).
* consolidated with UDP basis
* basic xfrm/netfilter support
* API documentation
Signed-off-by Gerrit Renker <[email protected]>
--
Documentation/networking/udplite.txt | 281 ++++++++++++++++++++ include/linux/in.h | 1 include/linux/socket.h | 1 include/linux/udp.h | 12 include/net/udp.h | 91 ++++++ include/net/udplite.h | 149 ++++++++++ include/net/xfrm.h | 2 net/ipv4/af_inet.c | 8 net/ipv4/netfilter/ipt_LOG.c | 11 net/ipv4/proc.c | 13 net/ipv4/udp.c | 481 ++++++++++++++++++++--------------- net/ipv4/udplite.c | 118 ++++++++ net/ipv4/xfrm4_policy.c | 1 net/netfilter/xt_multiport.c | 5 net/netfilter/xt_tcpudp.c | 20 + 15 files changed, 987 insertions(+), 207 deletions(-)
include/linux/in.h +1 -0
@@ -45,6 +45,7 @@ enum {IPPROTO_COMP =108 ,/* Compression Header protocol */ IPPROTO_SCTP =132 ,/* Stream Control Transport Protocol */ +IPPROTO_UDPLITE =136 ,/* UDP-Lite (RFC 3828) */ IPPROTO_RAW =255 ,/* Raw IP packets */ IPPROTO_MAX
include/linux/socket.h +1 -0
@@ -264,6 +264,7 @@ #define SOL_UDP 17#define SOL_IPV6 41#define SOL_ICMPV6 58#define SOL_SCTP 132 +#define SOL_UDPLITE 136/* UDP-Lite (RFC 3828) */ #define SOL_RAW 255#define SOL_IPX 256#define SOL_AX25 257
include/linux/udp.h +12 -0
@@ -38,6 +38,7 @@ #ifdef __KERNEL__#include <linux/types.h> #include <net/inet_sock.h> +#define UDP_HTABLE_SIZE 128struct udp_sock {/* inet_sock has to be the first member */
@@ -50,12 +51,23 @@ struct udp_sock {* when the socket is uncorked. */ __u16 len;/* total length of pending frames */ +/* +* Fields specific to UDP-Lite. +*/ +__u16 pcslen; +__u16 pcrlen; +/* indicator bits used by pcflag: */ +#define UDPLITE_BIT 0x1/* set by udplite proto init function */ +#define UDPLITE_SEND_CC 0x2/* set via udplite setsockopt */ +#define UDPLITE_RECV_CC 0x4/* set via udplite setsocktopt */ + __u8 pcflag; /* marks socket as UDP-Lite if > 0 */ };static inline struct udp_sock *udp_sk (const struct sock *sk) {return (struct udp_sock *)sk; } +#define IS_UDPLITE (__sk) (udp_sk(__sk)->pcflag)#endif
include/net/udp.h +87 -4
123 lines not on this page · raw message
include/net/udplite.h new file +149 -0
149 lines not on this page · raw message
net/ipv4/udp.c +285 -196
886 lines not on this page · raw message
net/ipv4/udplite.c new file +118 -0
118 lines not on this page · raw message
net/ipv4/af_inet.c +7 -1
@@ -104,6 +104,7 @@ #include <net/ip_fib.h>#include <net/inet_connection_sock.h> #include <net/tcp.h> #include <net/udp.h> +#include <net/udplite.h> #include <linux/skbuff.h> #include <net/sock.h> #include <net/raw.h>
@@ -1223,10 +1224,13 @@ static int __init init_ipv4_mibs(void) tcp_statistics[1] = alloc_percpu(struct tcp_mib); udp_statistics[0] = alloc_percpu(struct udp_mib); udp_statistics[1] = alloc_percpu(struct udp_mib); + udplite_statistics[0] = alloc_percpu(struct udp_mib); + udplite_statistics[1] = alloc_percpu(struct udp_mib);if (! (net_statistics[0 ] && net_statistics[1 ] && ip_statistics[0 ] && ip_statistics[1 ] && tcp_statistics[0 ] && tcp_statistics[1 ] - && udp_statistics[0 ] && udp_statistics[1 ])) + && udp_statistics[0 ] && udp_statistics[1 ] + && udplite_statistics[0 ] && udplite_statistics[1 ] ) )return -ENOMEM ; (void )tcp_mib_init ();
@@ -1313,6 +1317,8 @@ #endif/* Setup TCP slab cache for open requests. */ tcp_init (); +/* Add UDP-Lite (RFC 3828) */ +udplite4_register ();/* * Set the ICMP layer up
net/ipv4/proc.c +13 -0
@@ -38,6 +38,7 @@ #include <net/icmp.h>#include <net/protocol.h> #include <net/tcp.h> #include <net/udp.h> +#include <net/udplite.h> #include <linux/inetdevice.h> #include <linux/proc_fs.h> #include <linux/seq_file.h>
@@ -66,6 +67,7 @@ static int sockstat_seq_show(struct seq_ tcp_death_row.tw_count,atomic_read (&tcp_sockets_allocated), atomic_read(&tcp_memory_allocated));seq_printf (seq,"UDP: inuse %d\n" ,fold_prot_inuse (&udp_prot)); +seq_printf (seq,"UDPLITE: inuse %d\n" ,fold_prot_inuse (&udplite_prot));seq_printf (seq,"RAW: inuse %d\n" ,fold_prot_inuse (&raw_prot));seq_printf (seq,"FRAG: inuse %d memory %d\n" , ip_frag_nqueues,atomic_read (&ip_frag_mem));
@@ -304,6 +306,17 @@ static int snmp_seq_show(struct seq_filefold_field ((void **) udp_statistics, snmp4_udp_list[i].entry)); +/* the UDP and UDP-Lite MIBs are the same */ +seq_puts (seq,"\nUdpLite:" ); +for (i =0 ; snmp4_udp_list[i].name !=NULL ; i++) +seq_printf (seq," %s" , snmp4_udp_list[i].name); + +seq_puts (seq,"\nUdpLite:" ); +for (i =0 ; snmp4_udp_list[i].name !=NULL ; i++) +seq_printf (seq," %lu" , +fold_field ((void **) udplite_statistics, + snmp4_udp_list[i].entry) ); +seq_putc (seq,'\n' );return 0 ; }
include/net/xfrm.h +2 -0
@@ -468,6 +468,7 @@ __be16 xfrm_flowi_sport(struct flowi *flswitch (fl->proto) {case IPPROTO_TCP :case IPPROTO_UDP : +case IPPROTO_UDPLITE :case IPPROTO_SCTP : port = fl->fl_ip_sport;break ;
@@ -493,6 +494,7 @@ __be16 xfrm_flowi_dport(struct flowi *flswitch (fl->proto) {case IPPROTO_TCP :case IPPROTO_UDP : +case IPPROTO_UDPLITE :case IPPROTO_SCTP : port = fl->fl_ip_dport;break ;
net/ipv4/xfrm4_policy.c +1 -0
@@ -199,6 +199,7 @@ _decode_session4(struct sk_buff *skb, stif (!(iph->frag_off &htons (IP_MF |IP_OFFSET ))) {switch (iph->protocol) {case IPPROTO_UDP : +case IPPROTO_UDPLITE :case IPPROTO_TCP :case IPPROTO_SCTP :case IPPROTO_DCCP :
net/netfilter/xt_multiport.c +3 -2
@@ -1,5 +1,5 @@ -/* Kernel module to match one of a list of TCP/UDP/SCTP/DCCP ports: ports are in -the same place so we can treat them as equal. */ +/* Kernel module to match one of a list of TCP/UDP(-Lite)/SCTP/DCCP ports: +ports are in the same place so we can treat them as equal. */ /* (C) 1999-2001 Paul `Rusty' Russell * (C) 2002-2004 Netfilter Core Team <[email protected]>
@@ -162,6 +162,7 @@ check(u_int16_t proto, {/* Must specify supported protocol, no unknown flags or bad count */ return (proto ==IPPROTO_TCP || proto ==IPPROTO_UDP + || proto ==IPPROTO_UDPLITE || proto ==IPPROTO_SCTP || proto ==IPPROTO_DCCP ) && !(ip_invflags &XT_INV_PROTO ) && (match_flags == XT_MULTIPORT_SOURCE
net/netfilter/xt_tcpudp.c +19 -1
@@ -10,7 +10,7 @@ #include <linux/netfilter/xt_tcpudp.h>#include <linux/netfilter_ipv4/ip_tables.h> #include <linux/netfilter_ipv6/ip6_tables.h> -MODULE_DESCRIPTION ("x_tables match for TCP and UDP, supports IPv4 and IPv6" ); +MODULE_DESCRIPTION ("x_tables match for TCP and UDP(-Lite), supports IPv4 and IPv6" );MODULE_LICENSE ("GPL" );MODULE_ALIAS ("xt_tcp" );MODULE_ALIAS ("xt_udp" );
@@ -234,6 +234,24 @@ static struct xt_match xt_tcpudp_match[] .proto = IPPROTO_UDP, .me = THIS_MODULE, }, + { + .name = "udplite", + .family = AF_INET, + .checkentry = udp_checkentry, + .match = udp_match, + .matchsize = sizeof(struct xt_udp), + .proto = IPPROTO_UDPLITE, + .me = THIS_MODULE, + }, + { + .name = "udplite", + .family = AF_INET6, + .checkentry = udp_checkentry, + .match = udp_match, + .matchsize = sizeof(struct xt_udp), + .proto = IPPROTO_UDPLITE, + .me = THIS_MODULE, + }, };static int __init xt_tcpudp_init (void )
net/ipv4/netfilter/ipt_LOG.c +8 -3
@@ -171,11 +171,15 @@ static void dump_packet(const struct nf_ }break ; } -case IPPROTO_UDP : { +case IPPROTO_UDP : +case IPPROTO_UDPLITE : {struct udphdr _udph, *uh; -/* Max length: 10 "PROTO=UDP " */ -printk ("PROTO=UDP " ); +if (ih->protocol ==IPPROTO_UDP ) +/* Max length: 10 "PROTO=UDP " */ +printk ("PROTO=UDP " ); +else /* Max length: 14 "PROTO=UDPLITE " */ +printk ("PROTO=UDPLITE " );if (ntohs (ih->frag_off) &IP_OFFSET )break ;
@@ -341,6 +345,7 @@ static void dump_packet(const struct nf_/* IP: 40+46+6+11+127 = 230 */ /* TCP: 10+max(25,20+30+13+9+32+11+127) = 252 */ /* UDP: 10+max(25,20) = 35 */ +/* UDPLITE: 14+max(25,20) = 39 */ /* ICMP: 11+max(25, 18+25+max(19,14,24+3+n+10,3+n+10)) = 91+n */ /* ESP: 10+max(25)+15 = 50 */ /* AH: 9+max(25)+15 = 49 */
Documentation/networking/udplite.txt new file +281 -0
281 lines not on this page · raw message