aboutsummaryrefslogtreecommitdiff
path: root/net/ipv6
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>2013-01-21 06:49:25 +0000
committerDavid S. Miller <davem@davemloft.net>2013-01-21 13:33:18 -0500
commit4d5c152e8694b57094e320060be4621dee5779dd (patch)
treea9b0846968a4df192ec7cb890b5a929c67b61a9d /net/ipv6
parent1cb3fe513f62ca7c5963d551e01d75aa4f6ca72a (diff)
ndisc: Use compound literals to build redirect message.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/ndisc.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 1c015665ce7..76ef4353d51 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1481,18 +1481,14 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)
if (!buff)
goto release;
- skb_put(buff, sizeof(*msg));
- msg = (struct rd_msg *)icmp6_hdr(buff);
-
- memset(&msg->icmph, 0, sizeof(struct icmp6hdr));
- msg->icmph.icmp6_type = NDISC_REDIRECT;
-
- /*
- * copy target and destination addresses
- */
-
- msg->target = *target;
- msg->dest = ipv6_hdr(skb)->daddr;
+ msg = (struct rd_msg *)skb_put(buff, sizeof(*msg));
+ *msg = (struct rd_msg) {
+ .icmph = {
+ .icmp6_type = NDISC_REDIRECT,
+ },
+ .target = *target,
+ .dest = ipv6_hdr(skb)->daddr,
+ };
/*
* include target_address option