From: YOSHIFUJI Hideaki / 吉藤英明 Date: Mon, 21 Jan 2013 06:49:25 +0000 (+0000) Subject: ndisc: Use compound literals to build redirect message. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4d5c152e8694b57094e320060be4621dee5779dd;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git ndisc: Use compound literals to build redirect message. Signed-off-by: YOSHIFUJI Hideaki Signed-off-by: David S. Miller --- diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 1c015665ce71..76ef4353d518 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