ndisc: Use compound literals to build redirect message.
authorYOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>
Mon, 21 Jan 2013 06:49:25 +0000 (06:49 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 21 Jan 2013 18:33:18 +0000 (13:33 -0500)
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/ndisc.c

index 1c015665ce71ce85d9a0e9d1ea063bc31ee4d50f..76ef4353d51872c1688b52531eadf1f4f446a8a4 100644 (file)
@@ -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