Data Accelerator Offload
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions
dao_netlink_route.h File Reference
#include <linux/rtnetlink.h>
#include <netlink/cache.h>
#include <netlink/route/addr.h>
#include <netlink/route/link.h>
#include <netlink/route/neighbour.h>
#include <netlink/route/route.h>

Go to the source code of this file.

Data Structures

struct  dao_netlink_route_ip_addr
 
struct  dao_netlink_route_ip_route
 
struct  dao_netlink_route_ip_neigh
 
struct  dao_netlink_route_link
 
struct  dao_netlink_route_callback_ops
 

Macros

#define DAO_NETLINK_APP_IF_COOKIE_INITIALIZER   (~0u)
 
#define dao_foreach_netlink_neigh_states
 
#define dao_foreach_netlink_route_proto
 
#define dao_foreach_netlink_route_types
 

Typedefs

typedef struct dao_netlink_route_ip_addr dao_netlink_route_ip_addr_t
 
typedef struct dao_netlink_route_ip_route dao_netlink_route_ip_route_t
 
typedef struct dao_netlink_route_ip_neigh dao_netlink_route_ip_neigh_t
 
typedef struct dao_netlink_route_link dao_netlink_route_link_t
 
typedef struct dao_netlink_route_callback_ops dao_netlink_route_callback_ops_t
 

Enumerations

enum  dao_netlink_route_proto_t
 
enum  dao_netlink_route_types_t
 
enum  dao_netlink_route_nh_attr_t {
  DAO_NETLINK_ROUTE_NH_ATTR_ENCAP , DAO_NETLINK_ROUTE_NH_ATTR_NEWDST , DAO_NETLINK_ROUTE_NH_ATTR_VIA , DAO_NETLINK_ROUTE_NH_ATTR_VIA_GW ,
  DAO_NETLINK_ROUTE_NH_ATTR_IFINDEX , DAO_NETLINK_ROUTE_NH_ATTR_WEIGHT , DAO_NETLINK_ROUTE_NH_ATTR_REALMS , DAO_NETLINK_ROUTE_NH_ATTR_FLAGS
}
 
enum  dao_netlink_route_nh_flags_t
 
enum  dao_netlink_neigh_state_t
 

Functions

int dao_netlink_route_notifier_run (void)
 Function to synchronize LINUX route tables with application.
 
int dao_netlink_route_notifier_register (dao_netlink_route_callback_ops_t *ops, const char *prefix_interface_name)
 Register application callbacks for getting route updates.
 

Detailed Description

DAO Netlink file for route notifications

Definition in file dao_netlink_route.h.

Macro Definition Documentation

◆ DAO_NETLINK_APP_IF_COOKIE_INITIALIZER

#define DAO_NETLINK_APP_IF_COOKIE_INITIALIZER   (~0u)

Default initializer for interface app_cookie. Interface app_cookie is retrieved via dao_netlink_route_callback_ops.get_app_interface_cookie() during dao_netlink_route_notifier_register()

Definition at line 31 of file dao_netlink_route.h.

◆ dao_foreach_netlink_neigh_states

#define dao_foreach_netlink_neigh_states
Value:
_(0, INCOMPLETE) /* NUD_INCOMPLETE */ \
_(1, REACHABLE) /* NUD_REACHABLE */ \
_(2, STALE) /* NUD_STALE */ \
_(3, DELAY) /* NUD_DELAY */ \
_(4, PROBE) /* NUD_PROBE */ \
_(5, FAILED) /* NUD_FAILED */ \
_(6, NOARP) /* NUD_NOARP */ \
_(7, NONE) /* NUD_NONE */ \
_(8, PERMANENT) /* NUD_PERMANENT */

rtnl cache neighbor entry states

Definition at line 34 of file dao_netlink_route.h.

◆ dao_foreach_netlink_route_proto

#define dao_foreach_netlink_route_proto
Value:
_(0, UNSPEC) /* RTPROT_UNSPEC */ \
_(1, REDIRECT) /* RTPROT_REDIRECT */ \
_(2, KERNEL) /* RTPROT_KERNEL */ \
_(3, BOOT) /* RTPROT_BOOT */ \
_(4, STATIC) /* RTPROT_STATIC */

Rtnetlink protocol

Definition at line 46 of file dao_netlink_route.h.

◆ dao_foreach_netlink_route_types

#define dao_foreach_netlink_route_types
Value:
_(0, UNSPEC) /* RTN_UNSPEC */ \
_(1, UNICAST) /* RTN_UNICAST */ \
_(2, LOCAL) /* RTN_LOCAL */ \
_(3, BROADCAST) /* RTN_BROADCAST */ \
_(4, ANYCAST) /* RTN_ANYCAST */ \
_(5, MULTICAST) /* RTN_MULTICAST */ \
_(6, BLACKHOLE) /* RTN_BLACKHOLE */ \
_(7, UNREACHABLE) /* RTN_UNREACHABLE */ \
_(8, PROHIBIT) /* RTN_PROHIBIT */ \
_(9, THROW) /* RTN_THROW */ \
_(10, NAT) /* RTN_NAT */ \
_(11, XRESOLVE) /* RTN_XRESOLVE */

rtnl route object route types

Definition at line 93 of file dao_netlink_route.h.

Typedef Documentation

◆ dao_netlink_route_ip_addr_t

Structure describing IP Address which is filled from RTM_NEWADDR, RTM_DELADDR netlink messages

◆ dao_netlink_route_ip_route_t

Structure describing IP routes updates which is filled from RTM_NEWROUTE and RTM_DELROUTE netlink messages

◆ dao_netlink_route_ip_neigh_t

Structure describing IP neighbor updates which is filled from RTM_NEWNEIGH RTM_DELNEIGH netlink messages

◆ dao_netlink_route_link_t

Structure describing Link updates which is filled from RTM_NEWLINK and RTM_DELLINK netlink messages

◆ dao_netlink_route_callback_ops_t

High level route netlink ops for getting

Enumeration Type Documentation

◆ dao_netlink_route_proto_t

DAO IP Route Protocol enum

Definition at line 54 of file dao_netlink_route.h.

◆ dao_netlink_route_types_t

IP Route Types

Definition at line 108 of file dao_netlink_route.h.

◆ dao_netlink_route_nh_attr_t

Nexthop route attributes

if dao_netlink_route_ip_route_t.is_next_hop, nh_attr variables holds attributes

Enumerator
DAO_NETLINK_ROUTE_NH_ATTR_ENCAP 

Nexthop route holds IP encapsulation (RTA_ENCAP)

DAO_NETLINK_ROUTE_NH_ATTR_NEWDST 

Nexthop route holds new destination IP (RTA_NEWDST)

DAO_NETLINK_ROUTE_NH_ATTR_VIA 

Nexthop route holds via IP address (RTA_VIA)

DAO_NETLINK_ROUTE_NH_ATTR_VIA_GW 

Nexthop route holds via gateway IP address (RTA_VIA_GW)

DAO_NETLINK_ROUTE_NH_ATTR_IFINDEX 

Nexthop route holds Ifindex for routing

DAO_NETLINK_ROUTE_NH_ATTR_WEIGHT 

Netlink route weights for load-balancing

DAO_NETLINK_ROUTE_NH_ATTR_REALMS 

Nexthop route realms

DAO_NETLINK_ROUTE_NH_ATTR_FLAGS 

Nexthop route object holds valid flags (dao_netlink_route_nh_flags_t)

Definition at line 121 of file dao_netlink_route.h.

◆ dao_netlink_route_nh_flags_t

Nexthop route flags

if dao_netlink_route_ip_route_t.is_next_hop, nh_flags variables holds valid flags

Definition at line 146 of file dao_netlink_route.h.

◆ dao_netlink_neigh_state_t

IP Neighbor states

Definition at line 198 of file dao_netlink_route.h.

Function Documentation

◆ dao_netlink_route_notifier_run()

int dao_netlink_route_notifier_run ( void  )

Function to synchronize LINUX route tables with application.

Returns
0: Succese <0: Failure

◆ dao_netlink_route_notifier_register()

int dao_netlink_route_notifier_register ( dao_netlink_route_callback_ops_t ops,
const char *  prefix_interface_name 
)

Register application callbacks for getting route updates.

It uses low level dao_netlink_register() API to register for NETLINK_ROUTE protocol and multiple multicast_groups for IPv4. Netlink messages are parsed in dao_netlink_poll() processing context and passed to application via registered ops, if found relevant.

Parameters
opsFunction callback ops set by application
prefix_interface_nameString to filter out metlink messages and restrict them to those LINUX interfaces whose name has "prefix_interface_name" string.
Returns
0: Succese <0: Failure