1 /* Licensed under the OpenIB.org BSD license (FreeBSD Variant) - See COPYING.md
7 #include <netlink/route/rtnl.h>
8 #include <netlink/route/link.h>
9 #include <netlink/route/route.h>
10 #include <netlink/route/neighbour.h>
14 /* Workaround - declaration missing */
15 extern int rtnl_link_vlan_get_id(struct rtnl_link *);
17 #define nl_geterror(x) nl_geterror()
18 #define nl_sock nl_handle
20 static inline void nl_socket_disable_seq_check(struct nl_sock *sock)
22 nl_disable_sequence_check(sock);
25 struct rtnl_nexthop {};
27 static inline struct rtnl_nexthop *rtnl_route_nexthop_n(
28 struct rtnl_route *r, int n)
30 return (struct rtnl_nexthop *)r;
33 static inline struct nl_addr *rtnl_route_nh_get_gateway(struct rtnl_nexthop *nh)
35 return rtnl_route_get_gateway((struct rtnl_route *)nh);
38 static inline int rtnl_route_nh_get_ifindex(struct rtnl_nexthop *nh)
40 return rtnl_route_get_oif((struct rtnl_route *)nh);
43 #define nl_addr_info(addr, result) ( \
44 *(result) = nl_addr_info(addr), \
45 (*(result) == NULL) ? nl_get_errno() : 0 \
48 static inline void nl_socket_free(struct nl_sock *sock)
53 static inline struct nl_sock *nl_socket_alloc(void)
55 return nl_handle_alloc();
58 #define rtnl_link_alloc_cache(sock, family, result) ( \
59 *result = rtnl_link_alloc_cache(sock), \
60 (*result == NULL) ? nl_get_errno() : 0 \
63 #define rtnl_route_alloc_cache(sock, family, flags, result) ( \
64 *result = rtnl_route_alloc_cache(sock), \
65 (*result == NULL) ? nl_get_errno() : 0 \
68 #define rtnl_neigh_alloc_cache(sock, result) ( \
69 *result = rtnl_neigh_alloc_cache(sock), \
70 (*result == NULL) ? nl_get_errno() : 0 \
73 static inline int rtnl_link_is_vlan(struct rtnl_link *link)
75 return rtnl_link_vlan_get_id(link) <= 0;