Commit 84db8407 authored by Maciej Żenczykowski's avatar Maciej Żenczykowski Committed by David S. Miller

net: rtm_to_fib6_config() - use new style struct initializer instead of memset

(allows for better compiler optimization)
Signed-off-by: default avatarMaciej Żenczykowski <maze@google.com>
Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8823a3ac
...@@ -4143,14 +4143,19 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh, ...@@ -4143,14 +4143,19 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
err = -EINVAL; err = -EINVAL;
rtm = nlmsg_data(nlh); rtm = nlmsg_data(nlh);
memset(cfg, 0, sizeof(*cfg));
cfg->fc_table = rtm->rtm_table; *cfg = (struct fib6_config){
cfg->fc_dst_len = rtm->rtm_dst_len; .fc_table = rtm->rtm_table,
cfg->fc_src_len = rtm->rtm_src_len; .fc_dst_len = rtm->rtm_dst_len,
cfg->fc_flags = RTF_UP; .fc_src_len = rtm->rtm_src_len,
cfg->fc_protocol = rtm->rtm_protocol; .fc_flags = RTF_UP,
cfg->fc_type = rtm->rtm_type; .fc_protocol = rtm->rtm_protocol,
.fc_type = rtm->rtm_type,
.fc_nlinfo.portid = NETLINK_CB(skb).portid,
.fc_nlinfo.nlh = nlh,
.fc_nlinfo.nl_net = sock_net(skb->sk),
};
if (rtm->rtm_type == RTN_UNREACHABLE || if (rtm->rtm_type == RTN_UNREACHABLE ||
rtm->rtm_type == RTN_BLACKHOLE || rtm->rtm_type == RTN_BLACKHOLE ||
...@@ -4166,10 +4171,6 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh, ...@@ -4166,10 +4171,6 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
cfg->fc_flags |= (rtm->rtm_flags & RTNH_F_ONLINK); cfg->fc_flags |= (rtm->rtm_flags & RTNH_F_ONLINK);
cfg->fc_nlinfo.portid = NETLINK_CB(skb).portid;
cfg->fc_nlinfo.nlh = nlh;
cfg->fc_nlinfo.nl_net = sock_net(skb->sk);
if (tb[RTA_GATEWAY]) { if (tb[RTA_GATEWAY]) {
cfg->fc_gateway = nla_get_in6_addr(tb[RTA_GATEWAY]); cfg->fc_gateway = nla_get_in6_addr(tb[RTA_GATEWAY]);
cfg->fc_flags |= RTF_GATEWAY; cfg->fc_flags |= RTF_GATEWAY;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment