Adding rule with "From" option doesn't work
OK i found the bug, is is the patch !! Can someone push it into the git tree ? Regards, Romary Sonrier ========================= My analysis: I guess that the pay load is *struct fib_rule_hdr* struct fib_rule_hdr { __u8 family; __u8 dst_len; __u8 src_len; __u8 tos; __u8 table; __u8 res1; /* reserved */ __u8 res2; /* reserved */ __u8 action; __u32 flags; }; > [PAYLOAD] 12 octets > 02 00 00 00 0a 00 00 01 00 00 00 00 ............ so family = 02 , fine table = 10, fine but src_len =0 !!!! should be 32
This commit is contained in:
parent
cc33b0940f
commit
cb6a089d80
1 changed files with 8 additions and 6 deletions
|
@ -374,18 +374,20 @@ static int build_rule_msg(struct rtnl_rule *tmpl, int cmd, int flags,
|
|||
if (!msg)
|
||||
return -NLE_NOMEM;
|
||||
|
||||
if (tmpl->ce_mask & RULE_ATTR_SRC)
|
||||
frh.src_len = nl_addr_get_prefixlen(tmpl->r_src);
|
||||
|
||||
if (tmpl->ce_mask & RULE_ATTR_DST)
|
||||
frh.dst_len = nl_addr_get_prefixlen(tmpl->r_dst);
|
||||
|
||||
if (nlmsg_append(msg, &frh, sizeof(frh), NLMSG_ALIGNTO) < 0)
|
||||
goto nla_put_failure;
|
||||
|
||||
if (tmpl->ce_mask & RULE_ATTR_SRC) {
|
||||
frh.src_len = nl_addr_get_prefixlen(tmpl->r_src);
|
||||
if (tmpl->ce_mask & RULE_ATTR_SRC)
|
||||
NLA_PUT_ADDR(msg, FRA_SRC, tmpl->r_src);
|
||||
}
|
||||
|
||||
if (tmpl->ce_mask & RULE_ATTR_DST) {
|
||||
frh.dst_len = nl_addr_get_prefixlen(tmpl->r_dst);
|
||||
if (tmpl->ce_mask & RULE_ATTR_DST)
|
||||
NLA_PUT_ADDR(msg, FRA_DST, tmpl->r_dst);
|
||||
}
|
||||
|
||||
if (tmpl->ce_mask & RULE_ATTR_IIFNAME)
|
||||
NLA_PUT_STRING(msg, FRA_IIFNAME, tmpl->r_iifname);
|
||||
|
|
Loading…
Add table
Reference in a new issue