2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2022 Alexander V. Chernikov <melifaro@FreeBSD.org>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * NEXTHOP-related (RTM_<NEW|DEL|GET>NEXTHOP) message header and attributes.
32 #ifndef _NETLINK_ROUTE_NEXTHOP_H_
33 #define _NETLINK_ROUTE_NEXTHOP_H_
35 /* Base header for all of the relevant messages */
37 unsigned char nh_family; /* transport family */
38 unsigned char nh_scope; /* ignored on RX, filled by kernel */
39 unsigned char nh_protocol; /* Routing protocol that installed nh */
41 unsigned int nh_flags; /* RTNH_F_* flags from route.h */
46 NHA_ID, /* u32: nexthop userland index, auto-assigned if 0 */
47 NHA_GROUP, /* binary: array of struct nexthop_grp */
48 NHA_GROUP_TYPE, /* u16: set to NEXTHOP_GRP_TYPE */
49 NHA_BLACKHOLE, /* flag: nexthop used to blackhole packets */
50 NHA_OIF, /* u32: transmit ifindex */
51 NHA_GATEWAY, /* network: IPv4/IPv6 gateway addr */
52 NHA_ENCAP_TYPE, /* not supported */
53 NHA_ENCAP, /* not supported */
54 NHA_GROUPS, /* flag: match nexthop groups */
55 NHA_MASTER, /* not supported */
56 NHA_FDB, /* not supported */
57 NHA_RES_GROUP, /* not supported */
58 NHA_RES_BUCKET, /* not supported */
61 #define NHA_MAX (__NHA_MAX - 1)
64 * Attributes that can be used as filters:
65 * NHA_ID (nexhop or group), NHA_OIF, NHA_GROUPS,
69 * NHA_GROUP: array of the following structures.
70 * If attribute is set, the only other valid attributes are
71 * NHA_ID and NHA_GROUP_TYPE.
72 * NHA_RES_GROUP and NHA_RES_BUCKET are not supported yet
75 uint32_t id; /* nexhop userland index */
76 uint8_t weight; /* weight of this nexthop */
81 /* NHA_GROUP_TYPE: u16 */
83 NEXTHOP_GRP_TYPE_MPATH, /* default nexthop group */
84 NEXTHOP_GRP_TYPE_RES, /* resilient nexthop group */
85 __NEXTHOP_GRP_TYPE_MAX,
87 #define NEXTHOP_GRP_TYPE_MAX (__NEXTHOP_GRP_TYPE_MAX - 1)
93 NHA_RES_GROUP_PAD = NHA_RES_GROUP_UNSPEC,
94 NHA_RES_GROUP_BUCKETS,
95 NHA_RES_GROUP_IDLE_TIMER,
96 NHA_RES_GROUP_UNBALANCED_TIMER,
97 NHA_RES_GROUP_UNBALANCED_TIME,
100 #define NHA_RES_GROUP_MAX (__NHA_RES_GROUP_MAX - 1)