18 #include <netlink-local.h> 19 #include <netlink/netlink.h> 20 #include <netlink/utils.h> 21 #include <netlink/route/rtnl.h> 42 struct rtgenmsg gmsg = {
43 .rtgen_family = family,
56 static struct trans_tbl rtntypes[] = {
57 __ADD(RTN_UNSPEC,unspec)
58 __ADD(RTN_UNICAST,unicast)
59 __ADD(RTN_LOCAL,local)
60 __ADD(RTN_BROADCAST,broadcast)
61 __ADD(RTN_ANYCAST,anycast)
62 __ADD(RTN_MULTICAST,multicast)
63 __ADD(RTN_BLACKHOLE,blackhole)
64 __ADD(RTN_UNREACHABLE,unreachable)
65 __ADD(RTN_PROHIBIT,prohibit)
66 __ADD(RTN_THROW,
throw)
68 __ADD(RTN_XRESOLVE,xresolve)
71 char *nl_rtntype2str(
int type,
char *buf,
size_t size)
73 return __type2str(type, buf, size, rtntypes, ARRAY_SIZE(rtntypes));
76 int nl_str2rtntype(
const char *name)
78 return __str2type(name, rtntypes, ARRAY_SIZE(rtntypes));
88 static struct trans_tbl scopes[] = {
96 char *rtnl_scope2str(
int scope,
char *buf,
size_t size)
98 return __type2str(scope, buf, size, scopes, ARRAY_SIZE(scopes));
101 int rtnl_str2scope(
const char *name)
103 return __str2type(name, scopes, ARRAY_SIZE(scopes));
113 char * rtnl_realms2str(uint32_t realms,
char *buf,
size_t len)
118 snprintf(buf, len,
"%d/%d", from, to);
#define RTNL_REALM_TO(realm)
Extract TO realm from a realms field.
#define RTNL_REALM_FROM(realm)
Extract FROM realm from a realms field.
int nl_send_simple(struct nl_handle *handle, int type, int flags, void *buf, size_t size)
Send simple netlink message using nl_send_auto_complete()
int nl_rtgen_request(struct nl_handle *handle, int type, int family, int flags)
Send routing netlink request message.