zebra: Move netlink_route_nexthop_encap

Move this static function earlier so we can avoid
a predecleartion.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2024-05-08 12:46:08 -04:00
parent 084aba4ec0
commit ba5a3538e8

View File

@ -1891,6 +1891,33 @@ static inline bool _netlink_set_tag(struct nlmsghdr *n, unsigned int maxlen,
return true;
}
/*
* The function returns true if the attribute could be added
* to the message, otherwise false is returned.
*/
static int netlink_route_nexthop_encap(struct nlmsghdr *n, size_t nlen,
struct nexthop *nh)
{
struct rtattr *nest;
switch (nh->nh_encap_type) {
case NET_VXLAN:
if (!nl_attr_put16(n, nlen, RTA_ENCAP_TYPE, nh->nh_encap_type))
return false;
nest = nl_attr_nest(n, nlen, RTA_ENCAP);
if (!nest)
return false;
if (!nl_attr_put32(n, nlen, 0 /* VXLAN_VNI */, nh->nh_encap.vni))
return false;
nl_attr_nest_end(n, nest);
break;
}
return true;
}
/* This function takes a nexthop as argument and
* appends to the given netlink msg. If the nexthop
* defines a preferred source, the src parameter
@ -2149,34 +2176,6 @@ static bool nexthop_set_src(const struct nexthop *nexthop, int family,
return false;
}
/*
* The function returns true if the attribute could be added
* to the message, otherwise false is returned.
*/
static int netlink_route_nexthop_encap(struct nlmsghdr *n, size_t nlen,
struct nexthop *nh)
{
struct rtattr *nest;
switch (nh->nh_encap_type) {
case NET_VXLAN:
if (!nl_attr_put16(n, nlen, RTA_ENCAP_TYPE, nh->nh_encap_type))
return false;
nest = nl_attr_nest(n, nlen, RTA_ENCAP);
if (!nest)
return false;
if (!nl_attr_put32(n, nlen, 0 /* VXLAN_VNI */,
nh->nh_encap.vni))
return false;
nl_attr_nest_end(n, nest);
break;
}
return true;
}
/*
* Routing table change via netlink interface, using a dataplane context object
*