Skip to content

Commit

Permalink
ndisc: Use compound literals to build redirect message.
Browse files Browse the repository at this point in the history
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
YOSHIFUJI Hideaki / 吉藤英明 authored and David S. Miller committed Jan 21, 2013
1 parent 1cb3fe5 commit 4d5c152
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions net/ipv6/ndisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4d5c152

Please sign in to comment.