diff options
author | YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org> | 2013-01-21 01:49:13 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-01-21 13:33:17 -0500 |
commit | b44b5f4ae96de87e458ef73fc01e7ec0dbac10c0 (patch) | |
tree | 2466025a6f5217f4e912d1147e57389cf0d62838 | |
parent | 7b3d9b06d8b6407fe25e00e627b48ec0d4a2a076 (diff) |
ndisc: Break down __ndisc_send().
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv6/ndisc.c | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index dda4addf2919..79a56a7663b7 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -503,29 +503,12 @@ static void ndisc_send_skb(struct sk_buff *skb, | |||
503 | rcu_read_unlock(); | 503 | rcu_read_unlock(); |
504 | } | 504 | } |
505 | 505 | ||
506 | /* | ||
507 | * Send a Neighbour Discover packet | ||
508 | */ | ||
509 | static void __ndisc_send(struct net_device *dev, | ||
510 | const struct in6_addr *daddr, | ||
511 | const struct in6_addr *saddr, | ||
512 | struct icmp6hdr *icmp6h, const struct in6_addr *target, | ||
513 | int llinfo) | ||
514 | { | ||
515 | struct sk_buff *skb; | ||
516 | |||
517 | skb = ndisc_build_skb(dev, daddr, saddr, icmp6h, target, llinfo); | ||
518 | if (!skb) | ||
519 | return; | ||
520 | |||
521 | ndisc_send_skb(skb, daddr, saddr); | ||
522 | } | ||
523 | |||
524 | static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, | 506 | static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, |
525 | const struct in6_addr *daddr, | 507 | const struct in6_addr *daddr, |
526 | const struct in6_addr *solicited_addr, | 508 | const struct in6_addr *solicited_addr, |
527 | bool router, bool solicited, bool override, bool inc_opt) | 509 | bool router, bool solicited, bool override, bool inc_opt) |
528 | { | 510 | { |
511 | struct sk_buff *skb; | ||
529 | struct in6_addr tmpaddr; | 512 | struct in6_addr tmpaddr; |
530 | struct inet6_ifaddr *ifp; | 513 | struct inet6_ifaddr *ifp; |
531 | const struct in6_addr *src_addr; | 514 | const struct in6_addr *src_addr; |
@@ -553,8 +536,12 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, | |||
553 | icmp6h.icmp6_solicited = solicited; | 536 | icmp6h.icmp6_solicited = solicited; |
554 | icmp6h.icmp6_override = override; | 537 | icmp6h.icmp6_override = override; |
555 | 538 | ||
556 | __ndisc_send(dev, daddr, src_addr, &icmp6h, solicited_addr, | 539 | skb = ndisc_build_skb(dev, daddr, src_addr, &icmp6h, solicited_addr, |
557 | inc_opt ? ND_OPT_TARGET_LL_ADDR : 0); | 540 | inc_opt ? ND_OPT_TARGET_LL_ADDR : 0); |
541 | if (!skb) | ||
542 | return; | ||
543 | |||
544 | ndisc_send_skb(skb, daddr, src_addr); | ||
558 | } | 545 | } |
559 | 546 | ||
560 | static void ndisc_send_unsol_na(struct net_device *dev) | 547 | static void ndisc_send_unsol_na(struct net_device *dev) |
@@ -582,6 +569,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh, | |||
582 | const struct in6_addr *solicit, | 569 | const struct in6_addr *solicit, |
583 | const struct in6_addr *daddr, const struct in6_addr *saddr) | 570 | const struct in6_addr *daddr, const struct in6_addr *saddr) |
584 | { | 571 | { |
572 | struct sk_buff *skb; | ||
585 | struct in6_addr addr_buf; | 573 | struct in6_addr addr_buf; |
586 | struct icmp6hdr icmp6h = { | 574 | struct icmp6hdr icmp6h = { |
587 | .icmp6_type = NDISC_NEIGHBOUR_SOLICITATION, | 575 | .icmp6_type = NDISC_NEIGHBOUR_SOLICITATION, |
@@ -594,13 +582,18 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh, | |||
594 | saddr = &addr_buf; | 582 | saddr = &addr_buf; |
595 | } | 583 | } |
596 | 584 | ||
597 | __ndisc_send(dev, daddr, saddr, &icmp6h, solicit, | 585 | skb = ndisc_build_skb(dev, daddr, saddr, &icmp6h, solicit, |
598 | !ipv6_addr_any(saddr) ? ND_OPT_SOURCE_LL_ADDR : 0); | 586 | !ipv6_addr_any(saddr) ? ND_OPT_SOURCE_LL_ADDR : 0); |
587 | if (!skb) | ||
588 | return; | ||
589 | |||
590 | ndisc_send_skb(skb, daddr, saddr); | ||
599 | } | 591 | } |
600 | 592 | ||
601 | void ndisc_send_rs(struct net_device *dev, const struct in6_addr *saddr, | 593 | void ndisc_send_rs(struct net_device *dev, const struct in6_addr *saddr, |
602 | const struct in6_addr *daddr) | 594 | const struct in6_addr *daddr) |
603 | { | 595 | { |
596 | struct sk_buff *skb; | ||
604 | struct icmp6hdr icmp6h = { | 597 | struct icmp6hdr icmp6h = { |
605 | .icmp6_type = NDISC_ROUTER_SOLICITATION, | 598 | .icmp6_type = NDISC_ROUTER_SOLICITATION, |
606 | }; | 599 | }; |
@@ -628,8 +621,12 @@ void ndisc_send_rs(struct net_device *dev, const struct in6_addr *saddr, | |||
628 | } | 621 | } |
629 | } | 622 | } |
630 | #endif | 623 | #endif |
631 | __ndisc_send(dev, daddr, saddr, &icmp6h, NULL, | 624 | skb = ndisc_build_skb(dev, daddr, saddr, &icmp6h, NULL, |
632 | send_sllao ? ND_OPT_SOURCE_LL_ADDR : 0); | 625 | send_sllao ? ND_OPT_SOURCE_LL_ADDR : 0); |
626 | if (!skb) | ||
627 | return; | ||
628 | |||
629 | ndisc_send_skb(skb, daddr, saddr); | ||
633 | } | 630 | } |
634 | 631 | ||
635 | 632 | ||