mirror of
https://git.proxmox.com/git/mirror_frr
synced 2026-01-04 15:37:05 +00:00
zebra: derive rule family from src->dst->ipv4
Derive the rule family from src if available, otherwise dst if available, otherwise assume ipv4. We only support ipv4/ipv6 currently so it we cant tell from the src/dst it must be ipv4 and likely a dsfield match. Signed-off-by: Stephen Worley <sworley@nvidia.com>
This commit is contained in:
parent
67765a232d
commit
e36ea40d3b
@ -79,7 +79,15 @@ netlink_rule_msg_encode(int cmd, const struct zebra_dplane_ctx *ctx,
|
||||
if (buflen < sizeof(*req))
|
||||
return 0;
|
||||
memset(req, 0, sizeof(*req));
|
||||
family = PREFIX_FAMILY(src_ip);
|
||||
|
||||
/* Assume ipv4 if no src/dst set, we only support ipv4/ipv6 */
|
||||
if (PREFIX_FAMILY(src_ip))
|
||||
family = PREFIX_FAMILY(src_ip);
|
||||
else if (PREFIX_FAMILY(dst_ip))
|
||||
family = PREFIX_FAMILY(dst_ip);
|
||||
else
|
||||
family = AF_INET;
|
||||
|
||||
bytelen = (family == AF_INET ? 4 : 16);
|
||||
|
||||
req->n.nlmsg_type = cmd;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user