MIP6: Add receiving mobility header functions through raw socket.
Subsystems (2)
PATCH 17/20 MIP6: Add receiving mobility header functions through raw socket.
Like ICMPv6, mobility header is handled through raw socket.
In inbound case, check only whether ICMPv6 error should be sent as a reply or not by kernel.
Based on MIPL2 kernel patch.
--- include/net/mip6.h | 4 ++ net/ipv6/mip6.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++ net/ipv6/raw.c | 29 +++++++++++++++++ 3 files changed, 119 insertions(+), 1 deletions(-)
include/net/mip6.h +4 -0
@@ -25,6 +25,9 @@#ifndef _NET_MIP6_H#define _NET_MIP6_H +#include <linux/skbuff.h> +#include <net/sock.h> +#define MIP6_OPT_PAD_1 0#define MIP6_OPT_PAD_N 1
@@ -53,5 +56,6 @@ #define IP6_MH_TYPE_MAX IP6_MH_TYPE_BERextern int mip6_init (void );extern void mip6_fini (void ); +extern int mip6_mh_filter (struct sock *sk,struct sk_buff *skb);#endif
net/ipv6/mip6.c +87 -0
100 lines not on this page · raw message
net/ipv6/raw.c +28 -1
@@ -50,6 +50,9 @@ #include <net/transp_v6.h>#include <net/udp.h> #include <net/inet_common.h> #include <net/tcp_states.h> +#ifdef CONFIG_IPV6_MIP6 +#include <net/mip6.h> +#endif #include <net/rawv6.h> #include <net/xfrm.h>
@@ -169,8 +172,32 @@ int ipv6_raw_deliver(struct sk_buff *skb sk =__raw_v6_lookup (sk, nexthdr, daddr, saddr,IP6CB (skb)->iif);while (sk) { +int filtered; + delivered =1 ; -if (nexthdr !=IPPROTO_ICMPV6 || !icmpv6_filter (sk, skb)) { +switch (nexthdr) { +case IPPROTO_ICMPV6 : + filtered =icmpv6_filter (sk, skb); +break ; +#ifdef CONFIG_IPV6_MIP6 +case IPPROTO_MH : +/* XXX: MH validation: To validate only once, this is +* placed here. It should be after checking xfrm +* policy, however, it doesn't. The checking xfrm +* policy is placed in rawv6_rcv() because it is +* required for each socket. Fix it. +*/ + filtered =mip6_mh_filter (sk, skb); +break ; +#endif +default : + filtered =0 ; +break ; + } + +if (filtered <0 ) +break ; +if (filtered ==0 ) {struct sk_buff *clone =skb_clone (skb,GFP_ATOMIC );/* Not releasing hash table! */
Signature · 1 line
1.4.1