diff options
Diffstat (limited to 'net/ipv6/exthdrs.c')
-rw-r--r-- | net/ipv6/exthdrs.c | 64 |
1 files changed, 39 insertions, 25 deletions
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 | **********************************/ |