Skip to content

Commit

Permalink
include, zebra: Add recent nexthop.h
Browse files Browse the repository at this point in the history
Add actual recent nexthop.h file from kernel
and fix up resulting fallout because FRR's
original nexthop.h did not match upstream
linux kernel.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
  • Loading branch information
donaldsharp committed Oct 25, 2021
1 parent d965457 commit 73b8a68
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 7 deletions.
59 changes: 52 additions & 7 deletions include/linux/nexthop.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _LINUX_NEXTHOP_H
#define _LINUX_NEXTHOP_H
#ifndef _UAPI_LINUX_NEXTHOP_H
#define _UAPI_LINUX_NEXTHOP_H

#include <linux/types.h>

#define RTM_NHA(h) ((struct rtattr *)(((char *)(h)) + \
NLMSG_ALIGN(sizeof(struct nhmsg))))

struct nhmsg {
unsigned char nh_family;
unsigned char nh_scope; /* return only */
Expand All @@ -15,6 +12,7 @@ struct nhmsg {
unsigned int nh_flags; /* RTNH_F flags */
};

/* entry in a nexthop group */
struct nexthop_grp {
__u32 id; /* nexthop id - must exist */
__u8 weight; /* weight of this nexthop */
Expand All @@ -23,7 +21,10 @@ struct nexthop_grp {
};

enum {
NEXTHOP_GRP_TYPE_MPATH, /* default type if not specified */
NEXTHOP_GRP_TYPE_MPATH, /* hash-threshold nexthop group
* default type if not specified
*/
NEXTHOP_GRP_TYPE_RES, /* resilient nexthop group */
__NEXTHOP_GRP_TYPE_MAX,
};

Expand All @@ -50,10 +51,54 @@ enum {
*/
NHA_GROUPS, /* flag; only return nexthop groups in dump */
NHA_MASTER, /* u32; only return nexthops with given master dev */
NHA_FDB, /* nexthop belongs to a bridge fdb */

NHA_FDB, /* flag; nexthop belongs to a bridge fdb */
/* if NHA_FDB is added, OIF, BLACKHOLE, ENCAP cannot be set */

/* nested; resilient nexthop group attributes */
NHA_RES_GROUP,
/* nested; nexthop bucket attributes */
NHA_RES_BUCKET,

__NHA_MAX,
};

#define NHA_MAX (__NHA_MAX - 1)

enum {
NHA_RES_GROUP_UNSPEC,
/* Pad attribute for 64-bit alignment. */
NHA_RES_GROUP_PAD = NHA_RES_GROUP_UNSPEC,

/* u16; number of nexthop buckets in a resilient nexthop group */
NHA_RES_GROUP_BUCKETS,
/* clock_t as u32; nexthop bucket idle timer (per-group) */
NHA_RES_GROUP_IDLE_TIMER,
/* clock_t as u32; nexthop unbalanced timer */
NHA_RES_GROUP_UNBALANCED_TIMER,
/* clock_t as u64; nexthop unbalanced time */
NHA_RES_GROUP_UNBALANCED_TIME,

__NHA_RES_GROUP_MAX,
};

#define NHA_RES_GROUP_MAX (__NHA_RES_GROUP_MAX - 1)

enum {
NHA_RES_BUCKET_UNSPEC,
/* Pad attribute for 64-bit alignment. */
NHA_RES_BUCKET_PAD = NHA_RES_BUCKET_UNSPEC,

/* u16; nexthop bucket index */
NHA_RES_BUCKET_INDEX,
/* clock_t as u64; nexthop bucket idle time */
NHA_RES_BUCKET_IDLE_TIME,
/* u32; nexthop id assigned to the nexthop bucket */
NHA_RES_BUCKET_NH_ID,

__NHA_RES_BUCKET_MAX,
};

#define NHA_RES_BUCKET_MAX (__NHA_RES_BUCKET_MAX - 1)

#endif
1 change: 1 addition & 0 deletions zebra/debug_nl.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <stdint.h>

#include "zebra/rt_netlink.h"
#include "zebra/kernel_netlink.h"

const char *nlmsg_type2str(uint16_t type)
{
Expand Down
4 changes: 4 additions & 0 deletions zebra/kernel_netlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ extern "C" {

#ifdef HAVE_NETLINK

#define RTM_NHA(h) \
((struct rtattr *)(((char *)(h)) + NLMSG_ALIGN(sizeof(struct nhmsg))))


#define NL_RCV_PKT_BUF_SIZE 32768
#define NL_PKT_BUF_SIZE 8192

Expand Down

0 comments on commit 73b8a68

Please sign in to comment.