Re: [RFC][PATCHv2 2.6.18-rc4-mm3 3/3] net/ipv4: misc. support files

2006-08-29 Thread gerrit
Quoting Patrick McHardy:
|  [EMAIL PROTECTED] wrote:
|   [Net/IPv4]: REVISED Miscellaneous changes which complete the 
|   v4 support for UDP-Lite.
|   
|  
|   --- a/include/net/xfrm.h
|   +++ b/include/net/xfrm.h
|   @@ -467,6 +467,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;
|   @@ -492,6 +493,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;

Many thanks for the helpful pointers - I will make sure that the changes
are in the next version. I will be waiting a little while for further comments
before the update.

- Gerrit
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC][PATCHv2 2.6.18-rc4-mm3 3/3] net/ipv4: misc. support files

2006-08-28 Thread gerrit
[Net/IPv4]: REVISED Miscellaneous changes which complete the 
v4 support for UDP-Lite.


Signed-off-by: Gerrit Renker [EMAIL PROTECTED]
---

 include/linux/in.h |1 +
 include/linux/socket.h |1 +
 include/net/snmp.h |2 ++
 include/net/xfrm.h |2 ++
 net/ipv4/af_inet.c |   15 ++-
 net/ipv4/proc.c|   16 ++--
 net/ipv6/udp.c |1 +
 7 files changed, 35 insertions(+), 3 deletions(-)


diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 877e5b3..43faef2 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1223,10 +1223,14 @@ 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();
@@ -1300,6 +1304,11 @@ #endif
inet_register_protosw(q);
 
/*
+*  Add 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();
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index 9c6cbe3..608fe34 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -66,9 +66,10 @@ 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));
+   seq_printf(seq, FRAG: inuse %d memory %d\n, ip_frag_nqueues,
+atomic_read(ip_frag_mem));
return 0;
 }
 
@@ -304,6 +305,17 @@ static int snmp_seq_show(struct seq_file
   fold_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;
 }
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index b9cc55c..b72540b 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1073,6 +1073,7 @@ static struct udp_seq_afinfo udp6_seq_af
.owner  = THIS_MODULE,
.name   = udp6,
.family = AF_INET6,
+   .hashtable  = udp_hash,
.seq_show   = udp6_seq_show,
.seq_fops   = udp6_seq_fops,
 };
diff --git a/include/linux/in.h b/include/linux/in.h
index 94f557f..5ada82e 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -44,6 +44,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
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 3614090..592b666 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -264,6 +264,7 @@ #define SOL_UDP 17
 #define SOL_IPV6   41
 #define SOL_ICMPV6 58
 #define SOL_SCTP   132
+#define SOL_UDPLITE136 /* UDP-Lite (RFC 3828) */
 #define SOL_RAW255
 #define SOL_IPX256
 #define SOL_AX25   257
diff --git a/include/net/snmp.h b/include/net/snmp.h
index 

Re: [RFC][PATCHv2 2.6.18-rc4-mm3 3/3] net/ipv4: misc. support files

2006-08-28 Thread Patrick McHardy
[EMAIL PROTECTED] wrote:
 [Net/IPv4]: REVISED Miscellaneous changes which complete the 
 v4 support for UDP-Lite.
 

 --- a/include/net/xfrm.h
 +++ b/include/net/xfrm.h
 @@ -467,6 +467,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;
 @@ -492,6 +493,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;

You also need to adapt _decode_session[46] in xfrm[46]_policy.c for
IPsec. While you're at it you might consider adjusting xt_tcpudp,
xt_multiport, ipt_LOG and ip6t_LOG as well to get some basic
netfilter support. I'm going to take care of connection tracking
and NAT once this is in mainline.

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html