]> err.no Git - linux-2.6/commitdiff
[IPV6] MIP6: Add socket option and ancillary data interface of routing header type 2.
authorMasahide NAKAMURA <nakam@linux-ipv6.org>
Thu, 24 Aug 2006 02:17:12 +0000 (19:17 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Fri, 22 Sep 2006 22:06:49 +0000 (15:06 -0700)
Add socket option and ancillary data interface of routing header type
2.  Mobile IPv6 application will use this to send binding
acknowledgement with the header without relation of confirmed route
optimization (binding).

Based on MIPL2 kernel patch.

Signed-off-by: Masahide NAKAMURA <nakam@linux-ipv6.org>
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/datagram.c
net/ipv6/ipv6_sockglue.c

index 8561b9da6db615f5c3b1344fe09e259292083c78..7206747022fcf6407e71cedaf49be827badf0cdb 100644 (file)
@@ -648,10 +648,13 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
 
                        rthdr = (struct ipv6_rt_hdr *)CMSG_DATA(cmsg);
 
-                       /*
-                        *      TYPE 0
-                        */
-                       if (rthdr->type) {
+                       switch (rthdr->type) {
+                       case IPV6_SRCRT_TYPE_0:
+#ifdef CONFIG_IPV6_MIP6
+                       case IPV6_SRCRT_TYPE_2:
+#endif
+                               break;
+                       default:
                                err = -EINVAL;
                                goto exit_f;
                        }
index a5eaaf693abf7dad7c3e320f775bafa0f4be631b..4f3bb7fcc8b509ac71615e7a8c0f543d95349854 100644 (file)
@@ -407,8 +407,16 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
                /* routing header option needs extra check */
                if (optname == IPV6_RTHDR && opt->srcrt) {
                        struct ipv6_rt_hdr *rthdr = opt->srcrt;
-                       if (rthdr->type)
+                       switch (rthdr->type) {
+                       case IPV6_SRCRT_TYPE_0:
+#ifdef CONFIG_IPV6_MIP6
+                       case IPV6_SRCRT_TYPE_2:
+#endif
+                               break;
+                       default:
                                goto sticky_done;
+                       }
+
                        if ((rthdr->hdrlen & 1) ||
                            (rthdr->hdrlen >> 1) != rthdr->segments_left)
                                goto sticky_done;