From: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
To: davem@davemloft.net, netdev@vger.kernel.org
Cc: yoshfuji@linux-ipv6.org
Subject: [GIT PULL net-next 07/17] ipv6: Move ip6_nd_hdr() to its users' source files.
Date: Tue, 18 Dec 2012 19:54:27 +0900 [thread overview]
Message-ID: <50D04B63.5070106@linux-ipv6.org> (raw)
In-Reply-To: <50CF84A5.7030706@linux-ipv6.org>
This also makes return type to void since this function
never fails, and uses hoplimit argument instead of pointer
to struct sock. For ND, it also removes protocol argument.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
---
include/net/ipv6.h | 7 -------
net/ipv6/ip6_output.c | 27 ---------------------------
net/ipv6/mcast.c | 24 ++++++++++++++++++++++--
net/ipv6/ndisc.c | 24 +++++++++++++++++++++---
4 files changed, 43 insertions(+), 39 deletions(-)
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 710bf2b..dcc4b45 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -570,13 +570,6 @@ extern int ip6_xmit(struct sock *sk,
struct ipv6_txoptions *opt,
int tclass);
-extern int ip6_nd_hdr(struct sock *sk,
- struct sk_buff *skb,
- struct net_device *dev,
- const struct in6_addr *saddr,
- const struct in6_addr *daddr,
- int proto, int len);
-
extern int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr);
extern int ip6_append_data(struct sock *sk,
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 8c597b3..bb0c4cc 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -241,33 +241,6 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
EXPORT_SYMBOL(ip6_xmit);
-/*
- * To avoid extra problems ND packets are send through this
- * routine. It's code duplication but I really want to avoid
- * extra checks since ipv6_build_header is used by TCP (which
- * is for us performance critical)
- */
-
-int ip6_nd_hdr(struct sock *sk, struct sk_buff *skb, struct net_device *dev,
- const struct in6_addr *saddr, const struct in6_addr *daddr,
- int proto, int len)
-{
- struct ipv6_pinfo *np = inet6_sk(sk);
- struct ipv6hdr *hdr;
-
- skb->protocol = htons(ETH_P_IPV6);
- skb->dev = dev;
-
- skb_reset_network_header(skb);
- skb_put(skb, sizeof(struct ipv6hdr));
- hdr = ipv6_hdr(skb);
-
- __ip6_hdr(hdr, 0, 0, proto, np->hop_limit, saddr, daddr);
- hdr->payload_len = htons(len);
-
- return 0;
-}
-
static int ip6_call_ra_chain(struct sk_buff *skb, int sel)
{
struct ip6_ra_chain *ra;
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 28dfa5f..7c42776 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -1340,6 +1340,24 @@ mld_scount(struct ifmcaddr6 *pmc, int type, int gdeleted, int sdeleted)
return scount;
}
+static void ip6_mc_hdr(struct sk_buff *skb, struct net_device *dev,
+ const struct in6_addr *saddr,
+ const struct in6_addr *daddr,
+ int proto, int hoplimit, int len)
+{
+ struct ipv6hdr *hdr;
+
+ skb->protocol = htons(ETH_P_IPV6);
+ skb->dev = dev;
+
+ skb_reset_network_header(skb);
+ skb_put(skb, sizeof(struct ipv6hdr));
+ hdr = ipv6_hdr(skb);
+
+ __ip6_hdr(hdr, 0, 0, proto, hoplimit, saddr, daddr);
+ hdr->payload_len = htons(len);
+}
+
static struct sk_buff *mld_newpack(struct net_device *dev, int size)
{
struct net *net = dev_net(dev);
@@ -1375,7 +1393,8 @@ static struct sk_buff *mld_newpack(struct net_device *dev, int size)
} else
saddr = &addr_buf;
- ip6_nd_hdr(sk, skb, dev, saddr, &mld2_all_mcr, NEXTHDR_HOP, 0);
+ ip6_mc_hdr(skb, dev, saddr, &mld2_all_mcr,
+ NEXTHDR_HOP, inet6_sk(sk)->hop_limit, 0);
memcpy(skb_put(skb, sizeof(ra)), ra, sizeof(ra));
@@ -1767,7 +1786,8 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
} else
saddr = &addr_buf;
- ip6_nd_hdr(sk, skb, dev, saddr, snd_addr, NEXTHDR_HOP, payload_len);
+ ip6_mc_hdr(skb, dev, saddr, snd_addr, NEXTHDR_HOP,
+ inet6_sk(sk)->hop_limit, payload_len);
memcpy(skb_put(skb, sizeof(ra)), ra, sizeof(ra));
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 45ce72c..f2942f3 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -392,6 +392,24 @@ static struct sk_buff *ndisc_alloc_skb(struct net_device *dev,
return skb;
}
+static void ip6_nd_hdr(struct sk_buff *skb, struct net_device *dev,
+ const struct in6_addr *saddr,
+ const struct in6_addr *daddr,
+ int hoplimit, int len)
+{
+ struct ipv6hdr *hdr;
+
+ skb->protocol = htons(ETH_P_IPV6);
+ skb->dev = dev;
+
+ skb_reset_network_header(skb);
+ skb_put(skb, sizeof(struct ipv6hdr));
+ hdr = ipv6_hdr(skb);
+
+ __ip6_hdr(hdr, 0, 0, IPPROTO_ICMPV6, hoplimit, saddr, daddr);
+ hdr->payload_len = htons(len);
+}
+
static struct sk_buff *ndisc_build_skb(struct net_device *dev,
const struct in6_addr *daddr,
const struct in6_addr *saddr,
@@ -417,7 +435,7 @@ static struct sk_buff *ndisc_build_skb(struct net_device *dev,
if (!skb)
return NULL;
- ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len);
+ ip6_nd_hdr(skb, dev, saddr, daddr, inet6_sk(sk)->hop_limit, len);
skb->transport_header = skb->tail;
skb_put(skb, len);
@@ -1441,8 +1459,8 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)
if (!buff)
goto release;
- ip6_nd_hdr(sk, buff, dev, &saddr_buf, &ipv6_hdr(skb)->saddr,
- IPPROTO_ICMPV6, len);
+ ip6_nd_hdr(buff, dev, &saddr_buf, &ipv6_hdr(skb)->saddr,
+ inet6_sk(sk)->hop_limit, len);
skb_set_transport_header(buff, skb_tail_pointer(buff) - buff->data);
skb_put(buff, len);
--
1.7.9.5
next prev parent reply other threads:[~2012-12-18 10:54 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-17 20:46 [GIT PULL net-next] NDISC Updates (sender-side clean-up) YOSHIFUJI Hideaki
2012-12-17 22:31 ` David Miller
2012-12-18 10:52 ` [GIT PULL net-next 01/17] ndisc: Fix size calculation for headers YOSHIFUJI Hideaki
2012-12-19 0:23 ` David Miller
2012-12-19 0:24 ` David Miller
2012-12-19 3:00 ` YOSHIFUJI Hideaki
2012-12-19 3:08 ` YOSHIFUJI Hideaki
2012-12-18 10:52 ` [GIT PULL net-next 02/17] ipv6: Introduce __ip6_hdr() for setting IPv6 header YOSHIFUJI Hideaki
2012-12-18 10:53 ` [GIT PULL net-next 03/17] ndisc: Introduce struct red_msg for redirect message YOSHIFUJI Hideaki
2012-12-18 10:54 ` [GIT PULL net-next 04/17] ndisc: Introduce ndisc_fill_redirect_hdr_option() YOSHIFUJI Hideaki
[not found] ` <BAY173-W1475D04C810BF9A1D71FB8B0310@phx.gbl>
[not found] ` <BAY173-W14E9D67B7924486F0518F0B0310@phx.gbl>
[not found] ` <BAY173-W14E9D67B7924486F0518F0B0310-MsuGFMq8XAE@public.gmane.org>
2012-12-18 12:05 ` [IPv6] crashed when __ip6_del_rt() YOSHIFUJI Hideaki
2012-12-18 12:05 ` YOSHIFUJI Hideaki
2012-12-19 3:08 ` [GIT PULL net-next 04/17] ndisc: Introduce ndisc_fill_redirect_hdr_option() YOSHIFUJI Hideaki
2012-12-19 11:47 ` Bjørn Mork
2012-12-19 16:25 ` YOSHIFUJI Hideaki
2012-12-19 17:27 ` YOSHIFUJI Hideaki
2012-12-18 10:54 ` [GIT PULL net-next 05/17] ndisc: Rename and break up __ndisc_send() YOSHIFUJI Hideaki
2012-12-18 10:54 ` [GIT PULL net-next 06/17] ndisc: Introduce ndisc_send_skb_alloc() for sk_buff allocation YOSHIFUJI Hideaki
2012-12-18 10:54 ` YOSHIFUJI Hideaki [this message]
2012-12-18 10:54 ` [GIT PULL net-next 08/17] ndisc: Set skb->dev and skb->protocol inside ndisc_alloc_skb() YOSHIFUJI Hideaki
2012-12-18 10:54 ` [GIT PULL net-next 09/17] ndisc: Defer building IPv6 header YOSHIFUJI Hideaki
2012-12-18 10:55 ` [GIT PULL net-next 10/17] ndisc: Reset skb->transport_header inside ndisc_alloc_send_skb() YOSHIFUJI Hideaki
2012-12-18 10:55 ` [GIT PULL net-next 11/17] ndisc: Calculate message body length and option length separately YOSHIFUJI Hideaki
2012-12-18 10:55 ` [GIT PULL net-next 12/17] ndisc: Make ndisc_fill_xxx_option() for sk_buff YOSHIFUJI Hideaki
2012-12-18 10:56 ` [GIT PULL net-next 13/17] ndisc: Calculate checksum and build IPv6 header in __ndisc_send() YOSHIFUJI Hideaki
2012-12-18 10:56 ` [GIT PULL net-next 14/17] ndisc: Concentrate ndisc_send() on sending message YOSHIFUJI Hideaki
2012-12-18 10:56 ` [GIT PULL net-next 15/17] ndisc: Break down ndisc_build_skb() YOSHIFUJI Hideaki
2012-12-18 10:56 ` [GIT PULL net-next 16/17] ndisc: Fill in ND message on skb directly YOSHIFUJI Hideaki
2012-12-18 10:56 ` [GIT PULL net-next 17/17] ndisc: Use return value of __skb_put(), instead of icmp6_hdr() YOSHIFUJI Hideaki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50D04B63.5070106@linux-ipv6.org \
--to=yoshfuji@linux-ipv6.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.