From: Stephen Worley Date: Tue, 9 Apr 2019 14:35:11 +0000 (-0400) Subject: zebra: Fix late memset of pbr rule in rule_netlink X-Git-Tag: 7.1_pulled~85^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=cc42104c35610bba4c22f89b795aa506c2f28a91;p=matthieu%2Ffrr.git zebra: Fix late memset of pbr rule in rule_netlink We were memsetting zebra_pbr_rule struct after we had already put some information in it. Also updated the init of the struct to use braces instead of a memset. Signed-off-by: Stephen Worley --- diff --git a/zebra/rule_netlink.c b/zebra/rule_netlink.c index 477549f425..8cc5b52b34 100644 --- a/zebra/rule_netlink.c +++ b/zebra/rule_netlink.c @@ -185,7 +185,7 @@ int netlink_rule_change(struct nlmsghdr *h, ns_id_t ns_id, int startup) struct rtattr *tb[FRA_MAX + 1]; int len; char *ifname; - struct zebra_pbr_rule rule; + struct zebra_pbr_rule rule = {}; char buf1[PREFIX_STRLEN]; char buf2[PREFIX_STRLEN]; @@ -230,7 +230,6 @@ int netlink_rule_change(struct nlmsghdr *h, ns_id_t ns_id, int startup) if (!rule.ifp) return 0; - memset(&rule, 0, sizeof(rule)); if (tb[FRA_PRIORITY]) rule.rule.priority = *(uint32_t *)RTA_DATA(tb[FRA_PRIORITY]);