summaryrefslogtreecommitdiff
path: root/zebra/rt_netlink.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2024-05-08 12:46:08 -0400
committerDonald Sharp <sharpd@nvidia.com>2024-05-09 11:52:51 -0400
commitba5a3538e8b7198ac58e97c1cc6e65f7763359b2 (patch)
treef84d213d083e68f862b341468d89c82b21a35f17 /zebra/rt_netlink.c
parent084aba4ec06d2f9df31ce1e3964d5847bd618cee (diff)
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>
Diffstat (limited to 'zebra/rt_netlink.c')
-rw-r--r--zebra/rt_netlink.c55
1 files changed, 27 insertions, 28 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 4a15b74004..745f6497fb 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -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
@@ -2150,34 +2177,6 @@ static bool nexthop_set_src(const struct nexthop *nexthop, int family,
}
/*
- * 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
*
* Returns -1 on failure, 0 when the msg doesn't fit entirely in the buffer