Skip to contentSkip to conversation

net/ipv4: UDP-Lite v4 support

PATCH In review Gerrit Renker 1 participant 1 message Jul 14, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 2/3 net/ipv4: UDP-Lite v4 support

RFC 3828-compliant kernel support for UDP-Lite over IPv4.

---

 include/net/xfrm.h |    2
 net/ipv4/Makefile  |    1
 net/ipv4/af_inet.c |   17
 net/ipv4/proc.c    |   33 -
 net/ipv4/udplite.c | 1724 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 1773 insertions(+), 4 deletions(-)
net/ipv4/af_inet.c +15 -2
diff -Nurp  a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
@@ -105,6 +105,7 @@
 #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>
@@ -668,7 +669,7 @@ int inet_sendmsg(struct kiocb *iocb, str
 }
 
 
-static ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags)
+ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags)
 {
 	struct sock *sk = sock->sk;
 
@@ -838,6 +839,7 @@ const struct proto_ops inet_dgram_ops = 
 #endif
 };
 
+
 /*
  * For SOCK_RAW sockets; should be the same as inet_dgram_ops but without
  * udp_poll
@@ -898,7 +900,6 @@ static struct inet_protosw inetsw_array[
                 .no_check =   UDP_CSUM_DEFAULT,
                 .flags =      INET_PROTOSW_PERMANENT,
        },
-        
 
        {
                .type =       SOCK_RAW,
@@ -1229,6 +1230,9 @@ static int __init init_ipv4_mibs(void)
 	     && udp_statistics[0] && udp_statistics[1]))
 		return -ENOMEM;
 
+	if (! udplite4_mib_init())
+		return -ENOMEM;
+
 	(void) tcp_mib_init();
 
 	return 0;
@@ -1300,6 +1304,11 @@ static int __init inet_init(void)
 		inet_register_protosw(q);
 
 	/*
+	 * register UDP-Lite (RFC 3828)
+	 */
+	udplite4_register();
+
+	/*
 	 *	Set the ARP module up
 	 */
 
@@ -1367,6 +1376,8 @@ static int __init ipv4_proc_init(void)
 		goto out_tcp;
 	if (udp4_proc_init())
 		goto out_udp;
+	if (udplite4_proc_init())
+		goto out_udplite;
 	if (fib_proc_init())
 		goto out_fib;
 	if (ip_misc_proc_init())
@@ -1376,6 +1387,8 @@ out:
 out_misc:
 	fib_proc_exit();
 out_fib:
+	udplite4_proc_exit();
+out_udplite:
 	udp4_proc_exit();
 out_udp:
 	tcp4_proc_exit();
net/ipv4/udplite.c +1724 -0

1,724 lines not on this page · raw message

net/ipv4/proc.c +31 -2
diff -Nurp  a/net/ipv4/proc.c b/net/ipv4/proc.c
@@ -38,6 +38,7 @@
 #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,9 +67,12 @@ 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));
+#ifdef CONFIG_IP_UDPLITE
+	seq_printf(seq, "UDPLITE: inuse %d\n", fold_prot_inuse(&udplite_prot));
+#endif
 	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));
+	seq_printf(seq, "FRAG: inuse %d memory %d\n", ip_frag_nqueues,
+		             atomic_read(&ip_frag_mem));
 	return 0;
 }
 
@@ -176,6 +180,20 @@ static const struct snmp_mib snmp4_udp_l
 	SNMP_MIB_SENTINEL
 };
 
+#ifdef CONFIG_IP_UDPLITE
+static struct snmp_mib snmp4_udplite_list[] = {
+	SNMP_MIB_ITEM("InDatagrams",   UDPLITE_MIB_INDATAGRAMS),
+	SNMP_MIB_ITEM("InPartialCov",  UDPLITE_MIB_IN_PARTIALCOV),
+	SNMP_MIB_ITEM("NoPorts",       UDPLITE_MIB_NOPORTS),
+	SNMP_MIB_ITEM("InErrors",      UDPLITE_MIB_INERRORS),
+	SNMP_MIB_ITEM("InBadCoverage", UDPLITE_MIB_IN_BAD_COV),
+	SNMP_MIB_ITEM("InBadChecksum", UDPLITE_MIB_IN_BAD_CSUM),
+	SNMP_MIB_ITEM("OutDatagrams",  UDPLITE_MIB_OUTDATAGRAMS),
+	SNMP_MIB_ITEM("OutPartialCov", UDPLITE_MIB_OUT_PARTIALCOV),
+	SNMP_MIB_SENTINEL
+};
+#endif
+
 static const struct snmp_mib snmp4_net_list[] = {
 	SNMP_MIB_ITEM("SyncookiesSent", LINUX_MIB_SYNCOOKIESSENT),
 	SNMP_MIB_ITEM("SyncookiesRecv", LINUX_MIB_SYNCOOKIESRECV),
@@ -302,6 +320,17 @@ static int snmp_seq_show(struct seq_file
 			   fold_field((void **) udp_statistics, 
 				      snmp4_udp_list[i].entry));
 
+#ifdef CONFIG_IP_UDPLITE
+	seq_puts(seq, "\nUdpLite:");
+	for (i = 0; snmp4_udplite_list[i].name != NULL; i++)
+		seq_printf(seq, " %s", snmp4_udplite_list[i].name);
+
+	seq_puts(seq, "\nUdpLite:");
+	for (i = 0; snmp4_udplite_list[i].name != NULL; i++)
+		seq_printf(seq, " %lu",
+			   fold_field((void **) udplite_statistics,
+				      snmp4_udplite_list[i].entry));
+#endif
 	seq_putc(seq, '\n');
 	return 0;
 }
net/ipv4/Makefile +1 -0
diff -Nurp  a/net/ipv4/Makefile b/net/ipv4/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_IP_FIB_TRIE) += fib_trie.o
 obj-$(CONFIG_PROC_FS) += proc.o
 obj-$(CONFIG_IP_MULTIPLE_TABLES) += fib_rules.o
 obj-$(CONFIG_IP_MROUTE) += ipmr.o
+obj-$(CONFIG_IP_UDPLITE) += udplite.o
 obj-$(CONFIG_NET_IPIP) += ipip.o
 obj-$(CONFIG_NET_IPGRE) += ip_gre.o
 obj-$(CONFIG_SYN_COOKIES) += syncookies.o
include/net/xfrm.h +2 -0
diff -Nurp  a/include/net/xfrm.h b/include/net/xfrm.h
@@ -501,6 +501,7 @@ u16 xfrm_flowi_sport(struct flowi *fl)
 	switch(fl->proto) {
 	case IPPROTO_TCP:
 	case IPPROTO_UDP:
+	case IPPROTO_UDPLITE:
 	case IPPROTO_SCTP:
 		port = fl->fl_ip_sport;
 		break;
@@ -521,6 +522,7 @@ u16 xfrm_flowi_dport(struct flowi *fl)
 	switch(fl->proto) {
 	case IPPROTO_TCP:
 	case IPPROTO_UDP:
+	case IPPROTO_UDPLITE:
 	case IPPROTO_SCTP:
 		port = fl->fl_ip_dport;
 		break;