diff options
| -rw-r--r-- | include/net/transp_v6.h | 5 | ||||
| -rw-r--r-- | net/ipv6/af_inet6.c | 10 | ||||
| -rw-r--r-- | net/ipv6/exthdrs.c | 64 |
3 files changed, 48 insertions, 31 deletions
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h index 409da3a9a455..610b1bb775c9 100644 --- a/include/net/transp_v6.h +++ b/include/net/transp_v6.h | |||
| @@ -17,10 +17,9 @@ extern struct proto tcpv6_prot; | |||
| 17 | struct flowi; | 17 | struct flowi; |
| 18 | 18 | ||
| 19 | /* extention headers */ | 19 | /* extention headers */ |
| 20 | extern void ipv6_rthdr_init(void); | 20 | extern int ipv6_exthdrs_init(void); |
| 21 | extern void ipv6_exthdrs_exit(void); | ||
| 21 | extern void ipv6_frag_init(void); | 22 | extern void ipv6_frag_init(void); |
| 22 | extern void ipv6_nodata_init(void); | ||
| 23 | extern void ipv6_destopt_init(void); | ||
| 24 | 23 | ||
| 25 | /* transport protocols */ | 24 | /* transport protocols */ |
| 26 | extern void rawv6_init(void); | 25 | extern void rawv6_init(void); |
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 614f3d905dd1..442c298c1d7c 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
| @@ -859,10 +859,11 @@ static int __init inet6_init(void) | |||
| 859 | goto addrconf_fail; | 859 | goto addrconf_fail; |
| 860 | 860 | ||
| 861 | /* Init v6 extension headers. */ | 861 | /* Init v6 extension headers. */ |
| 862 | ipv6_rthdr_init(); | 862 | err = ipv6_exthdrs_init(); |
| 863 | if (err) | ||
| 864 | goto ipv6_exthdrs_fail; | ||
| 865 | |||
| 863 | ipv6_frag_init(); | 866 | ipv6_frag_init(); |
| 864 | ipv6_nodata_init(); | ||
| 865 | ipv6_destopt_init(); | ||
| 866 | 867 | ||
| 867 | /* Init v6 transport protocols. */ | 868 | /* Init v6 transport protocols. */ |
| 868 | udpv6_init(); | 869 | udpv6_init(); |
| @@ -874,6 +875,8 @@ static int __init inet6_init(void) | |||
| 874 | out: | 875 | out: |
| 875 | return err; | 876 | return err; |
| 876 | 877 | ||
| 878 | ipv6_exthdrs_fail: | ||
| 879 | addrconf_cleanup(); | ||
| 877 | addrconf_fail: | 880 | addrconf_fail: |
| 878 | ip6_flowlabel_cleanup(); | 881 | ip6_flowlabel_cleanup(); |
| 879 | ip6_flowlabel_fail: | 882 | ip6_flowlabel_fail: |
| @@ -932,6 +935,7 @@ static void __exit inet6_exit(void) | |||
| 932 | /* Cleanup code parts. */ | 935 | /* Cleanup code parts. */ |
| 933 | ipv6_packet_cleanup(); | 936 | ipv6_packet_cleanup(); |
| 934 | 937 | ||
| 938 | ipv6_exthdrs_exit(); | ||
| 935 | addrconf_cleanup(); | 939 | addrconf_cleanup(); |
| 936 | ip6_flowlabel_cleanup(); | 940 | ip6_flowlabel_cleanup(); |
| 937 | ip6_route_cleanup(); | 941 | ip6_route_cleanup(); |
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c index cee06b1655c1..2df34ed276f1 100644 --- a/net/ipv6/exthdrs.c +++ b/net/ipv6/exthdrs.c | |||
| @@ -308,28 +308,6 @@ static int ipv6_destopt_rcv(struct sk_buff *skb) | |||
| 308 | return -1; | 308 | return -1; |
| 309 | } | 309 | } |
| 310 | 310 | ||
| 311 | static struct inet6_protocol destopt_protocol = { | ||
| 312 | .handler = ipv6_destopt_rcv, | ||
| 313 | .flags = INET6_PROTO_NOPOLICY | INET6_PROTO_GSO_EXTHDR, | ||
| 314 | }; | ||
| 315 | |||
| 316 | void __init ipv6_destopt_init(void) | ||
| 317 | { | ||
| 318 | if (inet6_add_protocol(&destopt_protocol, IPPROTO_DSTOPTS) < 0) | ||
| 319 | printk(KERN_ERR "ipv6_destopt_init: Could not register protocol\n"); | ||
| 320 | } | ||
| 321 | |||
| 322 | static struct inet6_protocol nodata_protocol = { | ||
| 323 | .handler = dst_discard, | ||
| 324 | .flags = INET6_PROTO_NOPOLICY, | ||
| 325 | }; | ||
| 326 | |||
| 327 | void __init ipv6_nodata_init(void) | ||
| 328 | { | ||
| 329 | if (inet6_add_protocol(&nodata_protocol, IPPROTO_NONE) < 0) | ||
| 330 | printk(KERN_ERR "ipv6_nodata_init: Could not register protocol\n"); | ||
| 331 | } | ||
| 332 | |||
| 333 | /******************************** | 311 | /******************************** |
| 334 | Routing header. | 312 | Routing header. |
| 335 | ********************************/ | 313 | ********************************/ |
| @@ -527,12 +505,48 @@ static struct inet6_protocol rthdr_protocol = { | |||
| 527 | .flags = INET6_PROTO_NOPOLICY | INET6_PROTO_GSO_EXTHDR, | 505 | .flags = INET6_PROTO_NOPOLICY | INET6_PROTO_GSO_EXTHDR, |
| 528 | }; | 506 | }; |
| 529 | 507 | ||
| 530 | void __init ipv6_rthdr_init(void) | 508 | static struct inet6_protocol destopt_protocol = { |
| 509 | .handler = ipv6_destopt_rcv, | ||
| 510 | .flags = INET6_PROTO_NOPOLICY | INET6_PROTO_GSO_EXTHDR, | ||
| 511 | }; | ||
| 512 | |||
| 513 | static struct inet6_protocol nodata_protocol = { | ||
| 514 | .handler = dst_discard, | ||
| 515 | .flags = INET6_PROTO_NOPOLICY, | ||
| 516 | }; | ||
| 517 | |||
| 518 | int __init ipv6_exthdrs_init(void) | ||
| 531 | { | 519 | { |
| 532 | if (inet6_add_protocol(&rthdr_protocol, IPPROTO_ROUTING) < 0) | 520 | int ret; |
| 533 | printk(KERN_ERR "ipv6_rthdr_init: Could not register protocol\n"); | 521 | |
| 522 | ret = inet6_add_protocol(&rthdr_protocol, IPPROTO_ROUTING); | ||
| 523 | if (ret) | ||
| 524 | goto out; | ||
| 525 | |||
| 526 | ret = inet6_add_protocol(&destopt_protocol, IPPROTO_DSTOPTS); | ||
| 527 | if (ret) | ||
| 528 | goto out_rthdr; | ||
| 529 | |||
| 530 | ret = inet6_add_protocol(&nodata_protocol, IPPROTO_NONE); | ||
| 531 | if (ret) | ||
| 532 | goto out_destopt; | ||
| 533 | |||
| 534 | out: | ||
| 535 | return ret; | ||
| 536 | out_rthdr: | ||
| 537 | inet6_del_protocol(&rthdr_protocol, IPPROTO_ROUTING); | ||
| 538 | out_destopt: | ||
| 539 | inet6_del_protocol(&destopt_protocol, IPPROTO_DSTOPTS); | ||
| 540 | goto out; | ||
| 534 | }; | 541 | }; |
| 535 | 542 | ||
| 543 | void ipv6_exthdrs_exit(void) | ||
| 544 | { | ||
| 545 | inet6_del_protocol(&nodata_protocol, IPPROTO_NONE); | ||
| 546 | inet6_del_protocol(&destopt_protocol, IPPROTO_DSTOPTS); | ||
| 547 | inet6_del_protocol(&rthdr_protocol, IPPROTO_ROUTING); | ||
| 548 | } | ||
| 549 | |||
| 536 | /********************************** | 550 | /********************************** |
| 537 | Hop-by-hop options. | 551 | Hop-by-hop options. |
| 538 | **********************************/ | 552 | **********************************/ |
