Skip to content

Instantly share code, notes, and snippets.

@heatd
Created April 28, 2022 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heatd/72b338f3e86e32c1dab40445ec17e150 to your computer and use it in GitHub Desktop.
Save heatd/72b338f3e86e32c1dab40445ec17e150 to your computer and use it in GitHub Desktop.
struct netkernel_route4_add
{
struct in_addr dest;
struct in_addr gateway;
struct in_addr mask;
};
struct netkernel_route6_add
{
struct in6_addr dest;
struct in6_addr gateway;
struct in6_addr mask;
};
/**
* @brief Used to add a route to the routing table of a protocol
*
*/
struct netkernel_add_route
{
struct netkernel_hdr r_hdr;
int r_metric;
// Described in the INET_ROUTE_* flags
unsigned short r_flags;
uint32_t r_iface;
sa_family_t family;
union {
struct netkernel_route4_add inet;
struct netkernel_route6_add inet6;
} r_un;
};
// Routed through a gateway - gateway field valid
#define INET_ROUTE_FLAG_GATEWAY (1 << 0)
// ??
#define INET_ROUTE_FLAG_SCOPE_LOCAL (1 << 1)
// Multicast route
#define INET_ROUTE_FLAG_MULTICAST (1 << 2)
// Broadcast route
#define INET_ROUTE_FLAG_BROADCAST (1 << 3)
// Blackhole route - traffic is ignored
#define INET_ROUTE_FLAG_BLACKHOLE (1 << 4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment