@@ -1891,6 +1891,33 @@ static inline bool _netlink_set_tag(struct nlmsghdr *n, unsigned int maxlen,
1891
1891
return true;
1892
1892
}
1893
1893
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
+
1894
1921
/* This function takes a nexthop as argument and
1895
1922
* appends to the given netlink msg. If the nexthop
1896
1923
* defines a preferred source, the src parameter
@@ -2149,34 +2176,6 @@ static bool nexthop_set_src(const struct nexthop *nexthop, int family,
2149
2176
return false;
2150
2177
}
2151
2178
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
-
2180
2179
/*
2181
2180
* Routing table change via netlink interface, using a dataplane context object
2182
2181
*
0 commit comments