2023-02-08 13:17:09 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Router advertisement
|
2005-03-25 14:08:53 +01:00
|
|
|
* Copyright (C) 2005 6WIND <jean-mickael.guerin@6wind.com>
|
2002-12-13 21:15:29 +01:00
|
|
|
* Copyright (C) 1999 Kunihiro Ishiguro
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _ZEBRA_RTADV_H
|
|
|
|
#define _ZEBRA_RTADV_H
|
|
|
|
|
2022-02-04 14:04:23 +01:00
|
|
|
#include "zebra.h"
|
2008-08-15 15:05:22 +02:00
|
|
|
#include "vty.h"
|
2021-04-18 12:11:14 +02:00
|
|
|
#include "typesafe.h"
|
|
|
|
|
|
|
|
#include "zebra/zserv.h"
|
2006-08-06 18:02:43 +02:00
|
|
|
|
2019-03-25 15:11:55 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2021-04-18 12:11:14 +02:00
|
|
|
struct interface;
|
|
|
|
struct zebra_if;
|
|
|
|
|
2015-11-20 14:33:30 +01:00
|
|
|
#if defined(HAVE_RTADV)
|
2012-05-09 13:38:36 +02:00
|
|
|
|
2021-04-18 12:11:14 +02:00
|
|
|
PREDECL_SORTLIST_UNIQ(adv_if_list);
|
|
|
|
/* Structure which hold status of router advertisement. */
|
|
|
|
struct rtadv {
|
|
|
|
int sock;
|
|
|
|
|
|
|
|
struct adv_if_list_head adv_if;
|
|
|
|
struct adv_if_list_head adv_msec_if;
|
|
|
|
|
2022-03-01 22:18:12 +01:00
|
|
|
struct event *ra_read;
|
|
|
|
struct event *ra_timer;
|
2021-04-18 12:11:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
PREDECL_RBTREE_UNIQ(rtadv_prefixes);
|
2019-07-28 09:28:45 +02:00
|
|
|
PREDECL_SORTLIST_UNIQ(pref64_advs);
|
2021-04-18 12:11:14 +02:00
|
|
|
|
|
|
|
/* Router advertisement parameter. From RFC4861, RFC6275 and RFC4191. */
|
|
|
|
struct rtadvconf {
|
|
|
|
/* A flag indicating whether or not the router sends periodic Router
|
|
|
|
Advertisements and responds to Router Solicitations.
|
|
|
|
Default: false */
|
|
|
|
int AdvSendAdvertisements;
|
|
|
|
|
|
|
|
/* The maximum time allowed between sending unsolicited multicast
|
|
|
|
Router Advertisements from the interface, in milliseconds.
|
|
|
|
MUST be no less than 70 ms [RFC6275 7.5] and no greater
|
|
|
|
than 1800000 ms [RFC4861 6.2.1].
|
|
|
|
|
|
|
|
Default: 600000 milliseconds */
|
|
|
|
int MaxRtrAdvInterval;
|
|
|
|
#define RTADV_MAX_RTR_ADV_INTERVAL 600000
|
|
|
|
|
|
|
|
/* The minimum time allowed between sending unsolicited multicast
|
|
|
|
Router Advertisements from the interface, in milliseconds.
|
|
|
|
MUST be no less than 30 ms [RFC6275 7.5].
|
|
|
|
MUST be no greater than .75 * MaxRtrAdvInterval.
|
|
|
|
|
|
|
|
Default: 0.33 * MaxRtrAdvInterval */
|
|
|
|
int MinRtrAdvInterval; /* This field is currently unused. */
|
|
|
|
#define RTADV_MIN_RTR_ADV_INTERVAL (0.33 * RTADV_MAX_RTR_ADV_INTERVAL)
|
|
|
|
|
|
|
|
/* Unsolicited Router Advertisements' interval timer. */
|
|
|
|
int AdvIntervalTimer;
|
|
|
|
|
|
|
|
/* The true/false value to be placed in the "Managed address
|
|
|
|
configuration" flag field in the Router Advertisement. See
|
|
|
|
[ADDRCONF].
|
|
|
|
|
|
|
|
Default: false */
|
|
|
|
int AdvManagedFlag;
|
|
|
|
struct timeval lastadvmanagedflag;
|
|
|
|
|
|
|
|
|
|
|
|
/* The true/false value to be placed in the "Other stateful
|
|
|
|
configuration" flag field in the Router Advertisement. See
|
|
|
|
[ADDRCONF].
|
|
|
|
|
|
|
|
Default: false */
|
|
|
|
int AdvOtherConfigFlag;
|
|
|
|
struct timeval lastadvotherconfigflag;
|
|
|
|
|
|
|
|
/* The value to be placed in MTU options sent by the router. A
|
|
|
|
value of zero indicates that no MTU options are sent.
|
|
|
|
|
|
|
|
Default: 0 */
|
|
|
|
int AdvLinkMTU;
|
|
|
|
|
|
|
|
|
|
|
|
/* The value to be placed in the Reachable Time field in the Router
|
|
|
|
Advertisement messages sent by the router. The value zero means
|
|
|
|
unspecified (by this router). MUST be no greater than 3,600,000
|
|
|
|
milliseconds (1 hour).
|
|
|
|
|
|
|
|
Default: 0 */
|
|
|
|
uint32_t AdvReachableTime;
|
|
|
|
#define RTADV_MAX_REACHABLE_TIME 3600000
|
|
|
|
struct timeval lastadvreachabletime;
|
|
|
|
|
|
|
|
/* The value to be placed in the Retrans Timer field in the Router
|
|
|
|
Advertisement messages sent by the router. The value zero means
|
|
|
|
unspecified (by this router).
|
|
|
|
|
|
|
|
Default: 0 */
|
|
|
|
int AdvRetransTimer;
|
|
|
|
struct timeval lastadvretranstimer;
|
|
|
|
|
|
|
|
/* The default value to be placed in the Cur Hop Limit field in the
|
|
|
|
Router Advertisement messages sent by the router. The value
|
|
|
|
should be set to that current diameter of the Internet. The
|
|
|
|
value zero means unspecified (by this router).
|
|
|
|
|
|
|
|
Default: The value specified in the "Assigned Numbers" RFC
|
|
|
|
[ASSIGNED] that was in effect at the time of implementation. */
|
|
|
|
int AdvCurHopLimit;
|
|
|
|
struct timeval lastadvcurhoplimit;
|
|
|
|
|
|
|
|
#define RTADV_DEFAULT_HOPLIMIT 64 /* 64 hops */
|
|
|
|
|
|
|
|
/* The value to be placed in the Router Lifetime field of Router
|
|
|
|
Advertisements sent from the interface, in seconds. MUST be
|
|
|
|
either zero or between MaxRtrAdvInterval and 9000 seconds. A
|
|
|
|
value of zero indicates that the router is not to be used as a
|
|
|
|
default router.
|
|
|
|
|
|
|
|
Default: 3 * MaxRtrAdvInterval */
|
|
|
|
int AdvDefaultLifetime;
|
|
|
|
#define RTADV_MAX_RTRLIFETIME 9000 /* 2.5 hours */
|
|
|
|
|
|
|
|
/* A list of prefixes to be placed in Prefix Information options in
|
|
|
|
Router Advertisement messages sent from the interface.
|
|
|
|
|
|
|
|
Default: all prefixes that the router advertises via routing
|
|
|
|
protocols as being on-link for the interface from which the
|
|
|
|
advertisement is sent. The link-local prefix SHOULD NOT be
|
|
|
|
included in the list of advertised prefixes. */
|
|
|
|
struct rtadv_prefixes_head prefixes[1];
|
|
|
|
|
|
|
|
/* The true/false value to be placed in the "Home agent"
|
|
|
|
flag field in the Router Advertisement. See [RFC6275 7.1].
|
|
|
|
|
|
|
|
Default: false */
|
|
|
|
int AdvHomeAgentFlag;
|
|
|
|
#ifndef ND_RA_FLAG_HOME_AGENT
|
|
|
|
#define ND_RA_FLAG_HOME_AGENT 0x20
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* The value to be placed in Home Agent Information option if Home
|
|
|
|
Flag is set.
|
|
|
|
Default: 0 */
|
|
|
|
int HomeAgentPreference;
|
|
|
|
|
|
|
|
/* The value to be placed in Home Agent Information option if Home
|
|
|
|
Flag is set. Lifetime (seconds) MUST not be greater than 18.2
|
|
|
|
hours.
|
|
|
|
The value 0 has special meaning: use of AdvDefaultLifetime value.
|
|
|
|
|
|
|
|
Default: 0 */
|
|
|
|
int HomeAgentLifetime;
|
|
|
|
#define RTADV_MAX_HALIFETIME 65520 /* 18.2 hours */
|
|
|
|
|
|
|
|
/* The true/false value to insert or not an Advertisement Interval
|
|
|
|
option. See [RFC 6275 7.3]
|
|
|
|
|
|
|
|
Default: false */
|
|
|
|
int AdvIntervalOption;
|
|
|
|
|
|
|
|
/* The value to be placed in the Default Router Preference field of
|
|
|
|
a router advertisement. See [RFC 4191 2.1 & 2.2]
|
|
|
|
|
|
|
|
Default: 0 (medium) */
|
|
|
|
int DefaultPreference;
|
|
|
|
#define RTADV_PREF_MEDIUM 0x0 /* Per RFC4191. */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* List of recursive DNS servers to include in the RDNSS option.
|
|
|
|
* See [RFC8106 5.1]
|
|
|
|
*
|
|
|
|
* Default: empty list; do not emit RDNSS option
|
|
|
|
*/
|
|
|
|
struct list *AdvRDNSSList;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* List of DNS search domains to include in the DNSSL option.
|
|
|
|
* See [RFC8106 5.2]
|
|
|
|
*
|
|
|
|
* Default: empty list; do not emit DNSSL option
|
|
|
|
*/
|
|
|
|
struct list *AdvDNSSLList;
|
|
|
|
|
2019-07-28 09:28:45 +02:00
|
|
|
/* NAT64 prefix advertisements [RFC8781] */
|
|
|
|
struct pref64_advs_head pref64_advs[1];
|
|
|
|
|
2021-04-18 12:11:14 +02:00
|
|
|
/*
|
|
|
|
* rfc4861 states RAs must be sent at least 3 seconds apart.
|
|
|
|
* We allow faster retransmits to speed up convergence but can
|
|
|
|
* turn that capability off to meet the rfc if needed.
|
|
|
|
*/
|
|
|
|
bool UseFastRexmit; /* True if fast rexmits are enabled */
|
|
|
|
|
|
|
|
uint8_t inFastRexmit; /* True if we're rexmits faster than usual */
|
|
|
|
|
|
|
|
/* Track if RA was configured by BGP or by the Operator or both */
|
|
|
|
uint8_t ra_configured; /* Was RA configured? */
|
|
|
|
#define BGP_RA_CONFIGURED (1 << 0) /* BGP configured RA? */
|
|
|
|
#define VTY_RA_CONFIGURED (1 << 1) /* Operator configured RA? */
|
|
|
|
#define VTY_RA_INTERVAL_CONFIGURED \
|
|
|
|
(1 << 2) /* Operator configured RA interval */
|
|
|
|
int NumFastReXmitsRemain; /* Loaded first with number of fast
|
|
|
|
rexmits to do */
|
|
|
|
|
|
|
|
#define RTADV_FAST_REXMIT_PERIOD 1 /* 1 sec */
|
|
|
|
#define RTADV_NUM_FAST_REXMITS 4 /* Fast Rexmit RA 4 times on certain events \
|
|
|
|
*/
|
|
|
|
};
|
|
|
|
|
|
|
|
struct rtadv_rdnss {
|
|
|
|
/* Address of recursive DNS server to advertise */
|
|
|
|
struct in6_addr addr;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Lifetime in seconds; all-ones means infinity, zero
|
|
|
|
* stop using it.
|
|
|
|
*/
|
|
|
|
uint32_t lifetime;
|
|
|
|
|
|
|
|
/* If lifetime not set, use a default of 3*MaxRtrAdvInterval */
|
|
|
|
int lifetime_set;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* [RFC1035 2.3.4] sets the maximum length of a domain name (a sequence of
|
|
|
|
* labels, each prefixed by a length octet) at 255 octets.
|
|
|
|
*/
|
|
|
|
#define RTADV_MAX_ENCODED_DOMAIN_NAME 255
|
|
|
|
|
|
|
|
struct rtadv_dnssl {
|
|
|
|
/* Domain name without trailing root zone dot (NUL-terminated) */
|
|
|
|
char name[RTADV_MAX_ENCODED_DOMAIN_NAME - 1];
|
|
|
|
|
|
|
|
/* Name encoded as in [RFC1035 3.1] */
|
|
|
|
uint8_t encoded_name[RTADV_MAX_ENCODED_DOMAIN_NAME];
|
|
|
|
|
|
|
|
/* Actual length of encoded_name */
|
|
|
|
size_t encoded_len;
|
|
|
|
|
|
|
|
/* Lifetime as for RDNSS */
|
|
|
|
uint32_t lifetime;
|
|
|
|
int lifetime_set;
|
|
|
|
};
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Router advertisement prefix. */
|
|
|
|
struct rtadv_prefix {
|
2021-04-18 12:11:14 +02:00
|
|
|
struct rtadv_prefixes_item item;
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Prefix to be advertised. */
|
2012-01-08 15:27:12 +01:00
|
|
|
struct prefix_ipv6 prefix;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2020-02-10 19:58:41 +01:00
|
|
|
/* The prefix was manually/automatically defined. */
|
|
|
|
int AdvPrefixCreate;
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* The value to be placed in the Valid Lifetime in the Prefix */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t AdvValidLifetime;
|
2002-12-13 21:15:29 +01:00
|
|
|
#define RTADV_VALID_LIFETIME 2592000
|
|
|
|
|
|
|
|
/* The value to be placed in the on-link flag */
|
|
|
|
int AdvOnLinkFlag;
|
|
|
|
|
|
|
|
/* The value to be placed in the Preferred Lifetime in the Prefix
|
|
|
|
Information option, in seconds.*/
|
2018-03-27 21:13:34 +02:00
|
|
|
uint32_t AdvPreferredLifetime;
|
2002-12-13 21:15:29 +01:00
|
|
|
#define RTADV_PREFERRED_LIFETIME 604800
|
|
|
|
|
|
|
|
/* The value to be placed in the Autonomous Flag. */
|
|
|
|
int AdvAutonomousFlag;
|
2005-03-25 14:08:53 +01:00
|
|
|
|
2012-01-24 08:02:03 +01:00
|
|
|
/* The value to be placed in the Router Address Flag [RFC6275 7.2]. */
|
2005-03-25 14:08:53 +01:00
|
|
|
int AdvRouterAddressFlag;
|
|
|
|
#ifndef ND_OPT_PI_FLAG_RADDR
|
|
|
|
#define ND_OPT_PI_FLAG_RADDR 0x20
|
|
|
|
#endif
|
2002-12-13 21:15:29 +01:00
|
|
|
};
|
|
|
|
|
2019-11-22 18:31:29 +01:00
|
|
|
/* RFC4861 minimum delay between RAs */
|
|
|
|
#ifndef MIN_DELAY_BETWEEN_RAS
|
|
|
|
#define MIN_DELAY_BETWEEN_RAS 3000
|
|
|
|
#endif
|
|
|
|
|
2012-01-24 08:02:03 +01:00
|
|
|
/* RFC4584 Extension to Sockets API for Mobile IPv6 */
|
2005-03-25 14:08:53 +01:00
|
|
|
|
|
|
|
#ifndef ND_OPT_ADV_INTERVAL
|
|
|
|
#define ND_OPT_ADV_INTERVAL 7 /* Adv Interval Option */
|
|
|
|
#endif
|
|
|
|
#ifndef ND_OPT_HA_INFORMATION
|
|
|
|
#define ND_OPT_HA_INFORMATION 8 /* HA Information Option */
|
|
|
|
#endif
|
|
|
|
|
2022-10-12 13:59:37 +02:00
|
|
|
|
[autoconf] bugs 162,303,178: Fix 'present but can not be compiled' warnings
2007-05-09 Paul Jakma <paul.jakma@sun.com>
* configure.ac: sys/conf.h depends on sys/param.h, at least on
FBSD 6.2.
(bug #363) Should check for in_pktinfo for IRDP
2006-05-27 Paul Jakma <paul.jakma@sun.com>
* configure.ac: General cleanup of header and type checks, introducing
an internal define, QUAGGA_INCLUDES, to build up a list of
stuff to include so as to avoid 'present but cant be compiled'
warnings.
Misc additional checks of things missing according to autoscan.
Add LIBM, for bgpd's use of libm, so as to avoid burdening
LIBS, and all the binaries, with libm linkage.
Remove the bad practice of using m4 changequote(), just
quote the []'s in the case statements properly.
This should fix bugs 162, 303 and 178.
* */*.{c,h}: Update all HAVE_* to the standard autoconf namespaced
HAVE_* defines. I.e. HAVE_SA_LEN -> HAVE_STRUCT_SOCKADDR_SA_LEN,
* bgpd/Makefile.am: Add LIBM to bgpd's LDADD, for pow().
2007-05-10 04:38:51 +02:00
|
|
|
#ifndef HAVE_STRUCT_ND_OPT_ADV_INTERVAL
|
2005-03-25 14:08:53 +01:00
|
|
|
struct nd_opt_adv_interval { /* Advertisement interval option */
|
|
|
|
uint8_t nd_opt_ai_type;
|
|
|
|
uint8_t nd_opt_ai_len;
|
|
|
|
uint16_t nd_opt_ai_reserved;
|
|
|
|
uint32_t nd_opt_ai_interval;
|
|
|
|
} __attribute__((__packed__));
|
|
|
|
#else
|
[autoconf] bugs 162,303,178: Fix 'present but can not be compiled' warnings
2007-05-09 Paul Jakma <paul.jakma@sun.com>
* configure.ac: sys/conf.h depends on sys/param.h, at least on
FBSD 6.2.
(bug #363) Should check for in_pktinfo for IRDP
2006-05-27 Paul Jakma <paul.jakma@sun.com>
* configure.ac: General cleanup of header and type checks, introducing
an internal define, QUAGGA_INCLUDES, to build up a list of
stuff to include so as to avoid 'present but cant be compiled'
warnings.
Misc additional checks of things missing according to autoscan.
Add LIBM, for bgpd's use of libm, so as to avoid burdening
LIBS, and all the binaries, with libm linkage.
Remove the bad practice of using m4 changequote(), just
quote the []'s in the case statements properly.
This should fix bugs 162, 303 and 178.
* */*.{c,h}: Update all HAVE_* to the standard autoconf namespaced
HAVE_* defines. I.e. HAVE_SA_LEN -> HAVE_STRUCT_SOCKADDR_SA_LEN,
* bgpd/Makefile.am: Add LIBM to bgpd's LDADD, for pow().
2007-05-10 04:38:51 +02:00
|
|
|
#ifndef HAVE_STRUCT_ND_OPT_ADV_INTERVAL_ND_OPT_AI_TYPE
|
2005-03-25 14:08:53 +01:00
|
|
|
/* fields may have to be renamed */
|
|
|
|
#define nd_opt_ai_type nd_opt_adv_interval_type
|
|
|
|
#define nd_opt_ai_len nd_opt_adv_interval_len
|
|
|
|
#define nd_opt_ai_reserved nd_opt_adv_interval_reserved
|
|
|
|
#define nd_opt_ai_interval nd_opt_adv_interval_ival
|
|
|
|
#endif
|
|
|
|
#endif
|
2022-10-12 13:59:37 +02:00
|
|
|
#ifndef ND_OPT_RTR_ADV_INTERVAL
|
|
|
|
#define ND_OPT_RTR_ADV_INTERVAL 7
|
|
|
|
#endif
|
|
|
|
#ifndef ND_OPT_HOME_AGENT_INFO
|
|
|
|
#define ND_OPT_HOME_AGENT_INFO 8
|
|
|
|
#endif
|
2005-03-25 14:08:53 +01:00
|
|
|
|
[autoconf] bugs 162,303,178: Fix 'present but can not be compiled' warnings
2007-05-09 Paul Jakma <paul.jakma@sun.com>
* configure.ac: sys/conf.h depends on sys/param.h, at least on
FBSD 6.2.
(bug #363) Should check for in_pktinfo for IRDP
2006-05-27 Paul Jakma <paul.jakma@sun.com>
* configure.ac: General cleanup of header and type checks, introducing
an internal define, QUAGGA_INCLUDES, to build up a list of
stuff to include so as to avoid 'present but cant be compiled'
warnings.
Misc additional checks of things missing according to autoscan.
Add LIBM, for bgpd's use of libm, so as to avoid burdening
LIBS, and all the binaries, with libm linkage.
Remove the bad practice of using m4 changequote(), just
quote the []'s in the case statements properly.
This should fix bugs 162, 303 and 178.
* */*.{c,h}: Update all HAVE_* to the standard autoconf namespaced
HAVE_* defines. I.e. HAVE_SA_LEN -> HAVE_STRUCT_SOCKADDR_SA_LEN,
* bgpd/Makefile.am: Add LIBM to bgpd's LDADD, for pow().
2007-05-10 04:38:51 +02:00
|
|
|
#ifndef HAVE_STRUCT_ND_OPT_HOMEAGENT_INFO
|
2005-03-25 14:08:53 +01:00
|
|
|
struct nd_opt_homeagent_info { /* Home Agent info */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t nd_opt_hai_type;
|
|
|
|
uint8_t nd_opt_hai_len;
|
|
|
|
uint16_t nd_opt_hai_reserved;
|
|
|
|
uint16_t nd_opt_hai_preference;
|
|
|
|
uint16_t nd_opt_hai_lifetime;
|
2005-03-25 14:08:53 +01:00
|
|
|
} __attribute__((__packed__));
|
|
|
|
#endif
|
|
|
|
|
2019-01-26 23:51:48 +01:00
|
|
|
#ifndef ND_OPT_RDNSS
|
|
|
|
#define ND_OPT_RDNSS 25
|
|
|
|
#endif
|
|
|
|
#ifndef ND_OPT_DNSSL
|
|
|
|
#define ND_OPT_DNSSL 31
|
|
|
|
#endif
|
2019-07-28 09:28:45 +02:00
|
|
|
#ifndef ND_OPT_PREF64
|
|
|
|
#define ND_OPT_PREF64 38
|
|
|
|
#endif
|
2019-01-26 23:51:48 +01:00
|
|
|
|
|
|
|
#ifndef HAVE_STRUCT_ND_OPT_RDNSS
|
|
|
|
struct nd_opt_rdnss { /* Recursive DNS server option [RFC8106 5.1] */
|
|
|
|
uint8_t nd_opt_rdnss_type;
|
|
|
|
uint8_t nd_opt_rdnss_len;
|
|
|
|
uint16_t nd_opt_rdnss_reserved;
|
|
|
|
uint32_t nd_opt_rdnss_lifetime;
|
|
|
|
/* Followed by one or more IPv6 addresses */
|
|
|
|
} __attribute__((__packed__));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAVE_STRUCT_ND_OPT_DNSSL
|
|
|
|
struct nd_opt_dnssl { /* DNS search list option [RFC8106 5.2] */
|
|
|
|
uint8_t nd_opt_dnssl_type;
|
|
|
|
uint8_t nd_opt_dnssl_len;
|
|
|
|
uint16_t nd_opt_dnssl_reserved;
|
|
|
|
uint32_t nd_opt_dnssl_lifetime;
|
|
|
|
/*
|
|
|
|
* Followed by one or more domain names encoded as in [RFC1035 3.1].
|
|
|
|
* Multiple domain names are concatenated after encoding. In any case,
|
|
|
|
* the result is zero-padded to a multiple of 8 octets.
|
|
|
|
*/
|
|
|
|
} __attribute__((__packed__));
|
|
|
|
#endif
|
|
|
|
|
2019-07-28 09:28:45 +02:00
|
|
|
/* not in a system header (yet?)
|
|
|
|
* => added "__frr" to avoid future conflicts
|
|
|
|
*/
|
|
|
|
struct nd_opt_pref64__frr {
|
|
|
|
uint8_t nd_opt_pref64_type;
|
|
|
|
uint8_t nd_opt_pref64_len;
|
|
|
|
uint16_t nd_opt_pref64_lifetime_plc;
|
|
|
|
uint8_t nd_opt_pref64_prefix[12]; /* highest 96 bits only */
|
|
|
|
} __attribute__((__packed__));
|
|
|
|
|
|
|
|
|
|
|
|
#define PREF64_LIFETIME_AUTO UINT32_MAX
|
|
|
|
#define PREF64_DFLT_PREFIX "64:ff9b::/96"
|
|
|
|
|
|
|
|
struct pref64_adv {
|
|
|
|
struct pref64_advs_item itm;
|
|
|
|
|
|
|
|
struct prefix_ipv6 p;
|
|
|
|
uint32_t lifetime;
|
|
|
|
};
|
|
|
|
|
2020-02-10 19:58:41 +01:00
|
|
|
/*
|
|
|
|
* ipv6 nd prefixes can be manually defined, derived from the kernel interface
|
|
|
|
* configs or both. If both, manual flag/timer settings are used.
|
|
|
|
*/
|
|
|
|
enum ipv6_nd_prefix_source {
|
|
|
|
PREFIX_SRC_NONE = 0,
|
|
|
|
PREFIX_SRC_MANUAL,
|
|
|
|
PREFIX_SRC_AUTO,
|
|
|
|
PREFIX_SRC_BOTH,
|
|
|
|
};
|
|
|
|
|
2020-05-07 14:47:02 +02:00
|
|
|
enum ipv6_nd_suppress_ra_status {
|
2015-12-07 22:05:34 +01:00
|
|
|
RA_ENABLE = 0,
|
|
|
|
RA_SUPPRESS,
|
2020-05-07 14:47:02 +02:00
|
|
|
};
|
2015-12-07 22:05:34 +01:00
|
|
|
|
2021-05-26 23:36:16 +02:00
|
|
|
extern void rtadv_vrf_init(struct zebra_vrf *zvrf);
|
2020-04-02 17:16:50 +02:00
|
|
|
extern void rtadv_vrf_terminate(struct zebra_vrf *zvrf);
|
2019-12-03 15:02:20 +01:00
|
|
|
extern void rtadv_stop_ra(struct interface *ifp);
|
|
|
|
extern void rtadv_stop_ra_all(void);
|
2015-05-22 11:40:10 +02:00
|
|
|
extern void rtadv_cmd_init(void);
|
2021-04-18 12:11:14 +02:00
|
|
|
extern void rtadv_if_init(struct zebra_if *zif);
|
|
|
|
extern void rtadv_if_up(struct zebra_if *zif);
|
|
|
|
extern void rtadv_if_fini(struct zebra_if *zif);
|
2020-02-10 19:58:41 +01:00
|
|
|
extern void rtadv_add_prefix(struct zebra_if *zif, const struct prefix_ipv6 *p);
|
|
|
|
extern void rtadv_delete_prefix(struct zebra_if *zif, const struct prefix *p);
|
2021-04-18 12:11:14 +02:00
|
|
|
|
2024-01-23 20:32:16 +01:00
|
|
|
/* returns created prefix */
|
|
|
|
struct rtadv_prefix *rtadv_add_prefix_manual(struct zebra_if *zif,
|
|
|
|
struct rtadv_prefix *rp);
|
|
|
|
/* rprefix must be the one returned by rtadv_add_prefix_manual */
|
|
|
|
void rtadv_delete_prefix_manual(struct zebra_if *zif,
|
|
|
|
struct rtadv_prefix *rprefix);
|
|
|
|
|
2024-01-23 21:14:53 +01:00
|
|
|
/* returns created address */
|
|
|
|
struct rtadv_rdnss *rtadv_rdnss_set(struct zebra_if *zif,
|
|
|
|
struct rtadv_rdnss *rdnss);
|
|
|
|
/* p must be the one returned by rtadv_rdnss_set */
|
|
|
|
void rtadv_rdnss_reset(struct zebra_if *zif, struct rtadv_rdnss *p);
|
|
|
|
|
2024-01-23 22:00:45 +01:00
|
|
|
/* returns created domain */
|
|
|
|
struct rtadv_dnssl *rtadv_dnssl_set(struct zebra_if *zif,
|
|
|
|
struct rtadv_dnssl *dnssl);
|
|
|
|
/* p must be the one returned by rtadv_dnssl_set */
|
|
|
|
void rtadv_dnssl_reset(struct zebra_if *zif, struct rtadv_dnssl *p);
|
|
|
|
int rtadv_dnssl_encode(uint8_t *out, const char *in);
|
|
|
|
|
2019-07-28 09:28:45 +02:00
|
|
|
/* lifetime: 0-65535 or PREF64_LIFETIME_AUTO */
|
|
|
|
static inline bool rtadv_pref64_valid_prefix(const struct prefix_ipv6 *p)
|
|
|
|
{
|
|
|
|
switch (p->prefixlen) {
|
|
|
|
case 96:
|
|
|
|
case 64:
|
|
|
|
case 56:
|
|
|
|
case 48:
|
|
|
|
case 40:
|
|
|
|
case 32:
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct pref64_adv *rtadv_pref64_set(struct zebra_if *zif, struct prefix_ipv6 *p, uint32_t lifetime);
|
|
|
|
void rtadv_pref64_update(struct zebra_if *zif, struct pref64_adv *item, uint32_t lifetime);
|
|
|
|
void rtadv_pref64_reset(struct zebra_if *zif, struct pref64_adv *item);
|
|
|
|
|
2024-01-23 13:20:49 +01:00
|
|
|
void ipv6_nd_suppress_ra_set(struct interface *ifp,
|
|
|
|
enum ipv6_nd_suppress_ra_status status);
|
2024-01-23 15:04:39 +01:00
|
|
|
void ipv6_nd_interval_set(struct interface *ifp, uint32_t interval);
|
2024-01-23 13:20:49 +01:00
|
|
|
|
2021-04-18 12:11:14 +02:00
|
|
|
#else /* !HAVE_RTADV */
|
|
|
|
struct rtadv {
|
|
|
|
/* empty structs aren't valid ISO C */
|
|
|
|
char dummy;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct rtadvconf {
|
|
|
|
/* same again, empty structs aren't valid ISO C */
|
|
|
|
char dummy;
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline void rtadv_vrf_init(struct zebra_vrf *zvrf)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
static inline void rtadv_vrf_terminate(struct zebra_vrf *zvrf)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
static inline void rtadv_cmd_init(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
static inline void rtadv_if_init(struct zebra_if *zif)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
static inline void rtadv_if_up(struct zebra_if *zif)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
static inline void rtadv_if_fini(struct zebra_if *zif)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
static inline void rtadv_add_prefix(struct zebra_if *zif,
|
|
|
|
const struct prefix_ipv6 *p)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
static inline void rtadv_delete_prefix(struct zebra_if *zif,
|
|
|
|
const struct prefix *p)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
static inline void rtadv_stop_ra(struct interface *ifp)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
static inline void rtadv_stop_ra_all(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern void zebra_interface_radv_disable(ZAPI_HANDLER_ARGS);
|
|
|
|
extern void zebra_interface_radv_enable(ZAPI_HANDLER_ARGS);
|
|
|
|
|
2022-02-04 14:04:23 +01:00
|
|
|
extern uint32_t rtadv_get_interfaces_configured_from_bgp(void);
|
|
|
|
extern bool rtadv_compiled_in(void);
|
2023-12-12 19:29:47 +01:00
|
|
|
extern void rtadv_init(void);
|
zebra: Bring up 514 BGP neighbor sessions
Issue:
When 514 inerfaces/neighbors are configured, it creates socket error,
"Cannot allocate memory", when back to back V6 RA messages are tried
to be sent over the socket. This prevents interface, to know its peer's
link local address. Socket error comes when 1) try to join ICMPv6 all
router multicast group, back to back for all interfaces 2)send back to
back RA for all interfaces
Fix:
1)For ICMPv6 join case, we check if the interface has already joined
all router group, if not try to join. On failure, retry joining after
random amount of time determined 1 ms to ICMPV6_JOIN_TIMER_EXP_MS(100 ms)
2) For RA issue case, batch sending of RA mesages using wheel timer
Testing:
Monitor BGP session running sh bgp summary command
Before fix:
r1# sh bgp summary
IPv4 Unicast Summary:
BGP router identifier 192.168.1.1, local AS number 1001 VRF default vrf-id 0
BGP table version 0
RIB entries 0, using 0 bytes of memory
Peers 515, using 12 MiB of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc
r1-eth0 4 1002 89 90 0 0 0 00:07:10 0 0 N/A
r1-eth1 4 1002 89 90 0 0 0 00:07:10 0 0 N/A
r1-eth2 4 1002 89 90 0 0 0 00:07:10 0 0 N/A
r1-eth3 4 1002 89 90 0 0 0 00:07:10 0 0 N/A
r1-eth4 4 1002 89 90 0 0 0 00:07:10 0 0 N/A
r1-eth5 4 1002 89 90 0 0 0 00:07:10 0 0 N/A
…..<snip>...
r1-eth252 4 1002 31 29 0 0 0 00:02:08 0 0 N/A
r1-eth253 4 1002 31 29 0 0 0 00:02:08 0 0 N/A
r1-eth254 4 1002 31 29 0 0 0 00:02:08 0 0 N/A
r1-eth255 4 1002 31 29 0 0 0 00:02:08 0 0 N/A
r1-eth256 4 0 0 0 0 0 0 never Idle 0 N/A
r1-eth257 4 0 0 0 0 0 0 never Idle 0 N/A
r1-eth258 4 0 0 0 0 0 0 never Idle 0 N/A
r1-eth259 4 0 0 0 0 0 0 never Idle 0 N/A
r1-eth260 4 0 0 0 0 0 0 never Idle 0 N/A
……..<snip>…..
r1-eth511 4 0 0 0 0 0 0 never Idle 0 N/A
r1-eth512 4 0 0 0 0 0 0 never Idle 0 N/A
r1-eth513 4 0 0 0 0 0 0 never Idle 0 N/A
r1-eth514 4 0 0 0 0 0 0 never Idle 0 N/A
After fix:
r1# show bgp summary
IPv4 Unicast Summary:
BGP router identifier 192.168.1.1, local AS number 1001 VRF default vrf-id 0
BGP table version 0
RIB entries 0, using 0 bytes of memory
Peers 515, using 12 MiB of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc
r1-eth0 4 1002 87 87 0 0 0 00:07:04 0 0 N/A
r1-eth1 4 1002 87 87 0 0 0 00:07:04 0 0 N/A
r1-eth2 4 1002 87 87 0 0 0 00:07:04 0 0 N/A
r1-eth3 4 1002 64 67 0 0 0 00:05:09 0 0 N/A
r1-eth4 4 1002 87 87 0 0 0 00:07:04 0 0 N/A
r1-eth5 4 1002 87 87 0 0 0 00:07:04 0 0 N/A
r1-eth6 4 1002 67 70 0 0 0 00:05:22 0 0 N/A
r1-eth7 4 1002 87 87 0 0 0 00:07:04 0 0 N/A
r1-eth8 4 1002 87 87 0 0 0 00:07:04 0 0 N/A
....
r1-eth499 4 1002 43 43 0 0 0 00:03:22 0 0 N/A
r1-eth500 4 1002 43 43 0 0 0 00:03:22 0 0 N/A
r1-eth501 4 1002 19 22 0 0 0 00:01:21 0 0 N/A
r1-eth502 4 1002 43 43 0 0 0 00:03:22 0 0 N/A
r1-eth503 4 1002 43 43 0 0 0 00:03:22 0 0 N/A
r1-eth504 4 1002 20 23 0 0 0 00:01:30 0 0 N/A
r1-eth505 4 1002 43 43 0 0 0 00:03:22 0 0 N/A
r1-eth506 4 1002 43 43 0 0 0 00:03:22 0 0 N/A
r1-eth507 4 1002 22 25 0 0 0 00:01:39 0 0 N/A
r1-eth508 4 1002 43 43 0 0 0 00:03:22 0 0 N/A
r1-eth509 4 1002 17 20 0 0 0 00:01:13 0 0 N/A
r1-eth510 4 1002 43 43 0 0 0 00:03:22 0 0 N/A
r1-eth511 4 1002 43 43 0 0 0 00:03:22 0 0 N/A
r1-eth512 4 1002 19 22 0 0 0 00:01:22 0 0 N/A
r1-eth513 4 1002 43 43 0 0 0 00:03:22 0 0 N/A
r1-eth514 4 1002 43 43 0 0 0 00:03:22 0 0 N/A
Signed-off-by: Soumya Roy <souroy@nvidia.com>
2025-02-15 03:13:37 +01:00
|
|
|
extern void process_rtadv(void *arg);
|
2015-05-22 11:40:10 +02:00
|
|
|
|
2019-03-25 15:11:55 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2018-03-07 00:08:37 +01:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
#endif /* _ZEBRA_RTADV_H */
|