Skip to content

Commit ba5a353

Browse files
committed
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>
1 parent 084aba4 commit ba5a353

File tree

1 file changed

+27
-28
lines changed

1 file changed

+27
-28
lines changed

zebra/rt_netlink.c

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,6 +1891,33 @@ static inline bool _netlink_set_tag(struct nlmsghdr *n, unsigned int maxlen,
18911891
return true;
18921892
}
18931893

1894+
/*
1895+
* The function returns true if the attribute could be added
1896+
* to the message, otherwise false is returned.
1897+
*/
1898+
static int netlink_route_nexthop_encap(struct nlmsghdr *n, size_t nlen,
1899+
struct nexthop *nh)
1900+
{
1901+
struct rtattr *nest;
1902+
1903+
switch (nh->nh_encap_type) {
1904+
case NET_VXLAN:
1905+
if (!nl_attr_put16(n, nlen, RTA_ENCAP_TYPE, nh->nh_encap_type))
1906+
return false;
1907+
1908+
nest = nl_attr_nest(n, nlen, RTA_ENCAP);
1909+
if (!nest)
1910+
return false;
1911+
1912+
if (!nl_attr_put32(n, nlen, 0 /* VXLAN_VNI */, nh->nh_encap.vni))
1913+
return false;
1914+
nl_attr_nest_end(n, nest);
1915+
break;
1916+
}
1917+
1918+
return true;
1919+
}
1920+
18941921
/* This function takes a nexthop as argument and
18951922
* appends to the given netlink msg. If the nexthop
18961923
* defines a preferred source, the src parameter
@@ -2149,34 +2176,6 @@ static bool nexthop_set_src(const struct nexthop *nexthop, int family,
21492176
return false;
21502177
}
21512178

2152-
/*
2153-
* The function returns true if the attribute could be added
2154-
* to the message, otherwise false is returned.
2155-
*/
2156-
static int netlink_route_nexthop_encap(struct nlmsghdr *n, size_t nlen,
2157-
struct nexthop *nh)
2158-
{
2159-
struct rtattr *nest;
2160-
2161-
switch (nh->nh_encap_type) {
2162-
case NET_VXLAN:
2163-
if (!nl_attr_put16(n, nlen, RTA_ENCAP_TYPE, nh->nh_encap_type))
2164-
return false;
2165-
2166-
nest = nl_attr_nest(n, nlen, RTA_ENCAP);
2167-
if (!nest)
2168-
return false;
2169-
2170-
if (!nl_attr_put32(n, nlen, 0 /* VXLAN_VNI */,
2171-
nh->nh_encap.vni))
2172-
return false;
2173-
nl_attr_nest_end(n, nest);
2174-
break;
2175-
}
2176-
2177-
return true;
2178-
}
2179-
21802179
/*
21812180
* Routing table change via netlink interface, using a dataplane context object
21822181
*

0 commit comments

Comments
 (0)