mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 23:58:44 +00:00
pim6d: IPv6-adjust Hello/TLV processing
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
parent
9bb93fa04e
commit
11928ecf19
168
pimd/pim_hello.c
168
pimd/pim_hello.c
@ -33,81 +33,62 @@
|
|||||||
#include "pim_upstream.h"
|
#include "pim_upstream.h"
|
||||||
#include "pim_bsm.h"
|
#include "pim_bsm.h"
|
||||||
|
|
||||||
static void on_trace(const char *label, struct interface *ifp,
|
static void on_trace(const char *label, struct interface *ifp, pim_addr src)
|
||||||
struct in_addr src)
|
|
||||||
{
|
{
|
||||||
if (PIM_DEBUG_PIM_TRACE) {
|
if (PIM_DEBUG_PIM_TRACE)
|
||||||
char src_str[INET_ADDRSTRLEN];
|
zlog_debug("%s: from %pPAs on %s", label, &src, ifp->name);
|
||||||
pim_inet4_dump("<src?>", src, src_str, sizeof(src_str));
|
|
||||||
zlog_debug("%s: from %s on %s", label, src_str, ifp->name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tlv_trace_bool(const char *label, const char *tlv_name,
|
static void tlv_trace_bool(const char *label, const char *tlv_name,
|
||||||
const char *ifname, struct in_addr src_addr,
|
const char *ifname, pim_addr src_addr, int isset,
|
||||||
int isset, int value)
|
int value)
|
||||||
{
|
{
|
||||||
if (isset) {
|
if (isset)
|
||||||
char src_str[INET_ADDRSTRLEN];
|
|
||||||
pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
|
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"%s: PIM hello option from %s on interface %s: %s=%d",
|
"%s: PIM hello option from %pPAs on interface %s: %s=%d",
|
||||||
label, src_str, ifname, tlv_name, value);
|
label, &src_addr, ifname, tlv_name, value);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tlv_trace_uint16(const char *label, const char *tlv_name,
|
static void tlv_trace_uint16(const char *label, const char *tlv_name,
|
||||||
const char *ifname, struct in_addr src_addr,
|
const char *ifname, pim_addr src_addr, int isset,
|
||||||
int isset, uint16_t value)
|
uint16_t value)
|
||||||
{
|
{
|
||||||
if (isset) {
|
if (isset)
|
||||||
char src_str[INET_ADDRSTRLEN];
|
|
||||||
pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
|
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"%s: PIM hello option from %s on interface %s: %s=%u",
|
"%s: PIM hello option from %pPAs on interface %s: %s=%u",
|
||||||
label, src_str, ifname, tlv_name, value);
|
label, &src_addr, ifname, tlv_name, value);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tlv_trace_uint32(const char *label, const char *tlv_name,
|
static void tlv_trace_uint32(const char *label, const char *tlv_name,
|
||||||
const char *ifname, struct in_addr src_addr,
|
const char *ifname, pim_addr src_addr, int isset,
|
||||||
int isset, uint32_t value)
|
uint32_t value)
|
||||||
{
|
{
|
||||||
if (isset) {
|
if (isset)
|
||||||
char src_str[INET_ADDRSTRLEN];
|
|
||||||
pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
|
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"%s: PIM hello option from %s on interface %s: %s=%u",
|
"%s: PIM hello option from %pPAs on interface %s: %s=%u",
|
||||||
label, src_str, ifname, tlv_name, value);
|
label, &src_addr, ifname, tlv_name, value);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tlv_trace_uint32_hex(const char *label, const char *tlv_name,
|
static void tlv_trace_uint32_hex(const char *label, const char *tlv_name,
|
||||||
const char *ifname, struct in_addr src_addr,
|
const char *ifname, pim_addr src_addr,
|
||||||
int isset, uint32_t value)
|
int isset, uint32_t value)
|
||||||
{
|
{
|
||||||
if (isset) {
|
if (isset)
|
||||||
char src_str[INET_ADDRSTRLEN];
|
|
||||||
pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
|
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"%s: PIM hello option from %s on interface %s: %s=%08x",
|
"%s: PIM hello option from %pPAs on interface %s: %s=%08x",
|
||||||
label, src_str, ifname, tlv_name, value);
|
label, &src_addr, ifname, tlv_name, value);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tlv_trace_list(const char *label, const char *tlv_name,
|
static void tlv_trace_list(const char *label, const char *tlv_name,
|
||||||
const char *ifname, struct in_addr src_addr,
|
const char *ifname, pim_addr src_addr, int isset,
|
||||||
int isset, struct list *addr_list)
|
struct list *addr_list)
|
||||||
{
|
{
|
||||||
if (isset) {
|
if (isset)
|
||||||
char src_str[INET_ADDRSTRLEN];
|
|
||||||
pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
|
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"%s: PIM hello option from %s on interface %s: %s size=%d list=%p",
|
"%s: PIM hello option from %pPAs on interface %s: %s size=%d list=%p",
|
||||||
label, src_str, ifname, tlv_name,
|
label, &src_addr, ifname, tlv_name,
|
||||||
addr_list ? ((int)listcount(addr_list)) : -1,
|
addr_list ? ((int)listcount(addr_list)) : -1,
|
||||||
(void *)addr_list);
|
(void *)addr_list);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FREE_ADDR_LIST \
|
#define FREE_ADDR_LIST \
|
||||||
@ -121,8 +102,8 @@ static void tlv_trace_list(const char *label, const char *tlv_name,
|
|||||||
return (code); \
|
return (code); \
|
||||||
}
|
}
|
||||||
|
|
||||||
int pim_hello_recv(struct interface *ifp, struct in_addr src_addr,
|
int pim_hello_recv(struct interface *ifp, pim_addr src_addr, uint8_t *tlv_buf,
|
||||||
uint8_t *tlv_buf, int tlv_buf_size)
|
int tlv_buf_size)
|
||||||
{
|
{
|
||||||
struct pim_interface *pim_ifp;
|
struct pim_interface *pim_ifp;
|
||||||
struct pim_neighbor *neigh;
|
struct pim_neighbor *neigh;
|
||||||
@ -158,15 +139,11 @@ int pim_hello_recv(struct interface *ifp, struct in_addr src_addr,
|
|||||||
int remain = tlv_pastend - tlv_curr;
|
int remain = tlv_pastend - tlv_curr;
|
||||||
|
|
||||||
if (remain < PIM_TLV_MIN_SIZE) {
|
if (remain < PIM_TLV_MIN_SIZE) {
|
||||||
if (PIM_DEBUG_PIM_HELLO) {
|
if (PIM_DEBUG_PIM_HELLO)
|
||||||
char src_str[INET_ADDRSTRLEN];
|
|
||||||
pim_inet4_dump("<src?>", src_addr, src_str,
|
|
||||||
sizeof(src_str));
|
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"%s: short PIM hello TLV size=%d < min=%d from %s on interface %s",
|
"%s: short PIM hello TLV size=%d < min=%d from %pPAs on interface %s",
|
||||||
__func__, remain, PIM_TLV_MIN_SIZE,
|
__func__, remain, PIM_TLV_MIN_SIZE,
|
||||||
src_str, ifp->name);
|
&src_addr, ifp->name);
|
||||||
}
|
|
||||||
FREE_ADDR_LIST_THEN_RETURN(-1);
|
FREE_ADDR_LIST_THEN_RETURN(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,28 +153,20 @@ int pim_hello_recv(struct interface *ifp, struct in_addr src_addr,
|
|||||||
tlv_curr += PIM_TLV_LENGTH_SIZE;
|
tlv_curr += PIM_TLV_LENGTH_SIZE;
|
||||||
|
|
||||||
if ((tlv_curr + option_len) > tlv_pastend) {
|
if ((tlv_curr + option_len) > tlv_pastend) {
|
||||||
if (PIM_DEBUG_PIM_HELLO) {
|
if (PIM_DEBUG_PIM_HELLO)
|
||||||
char src_str[INET_ADDRSTRLEN];
|
|
||||||
pim_inet4_dump("<src?>", src_addr, src_str,
|
|
||||||
sizeof(src_str));
|
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"%s: long PIM hello TLV type=%d length=%d > left=%td from %s on interface %s",
|
"%s: long PIM hello TLV type=%d length=%d > left=%td from %pPAs on interface %s",
|
||||||
__func__, option_type, option_len,
|
__func__, option_type, option_len,
|
||||||
tlv_pastend - tlv_curr, src_str,
|
tlv_pastend - tlv_curr, &src_addr,
|
||||||
ifp->name);
|
ifp->name);
|
||||||
}
|
|
||||||
FREE_ADDR_LIST_THEN_RETURN(-2);
|
FREE_ADDR_LIST_THEN_RETURN(-2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PIM_DEBUG_PIM_HELLO) {
|
if (PIM_DEBUG_PIM_HELLO)
|
||||||
char src_str[INET_ADDRSTRLEN];
|
|
||||||
pim_inet4_dump("<src?>", src_addr, src_str,
|
|
||||||
sizeof(src_str));
|
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"%s: parse left_size=%d: PIM hello TLV type=%d length=%d from %s on %s",
|
"%s: parse left_size=%d: PIM hello TLV type=%d length=%d from %pPAs on %s",
|
||||||
__func__, remain, option_type, option_len,
|
__func__, remain, option_type, option_len,
|
||||||
src_str, ifp->name);
|
&src_addr, ifp->name);
|
||||||
}
|
|
||||||
|
|
||||||
switch (option_type) {
|
switch (option_type) {
|
||||||
case PIM_MSG_OPTION_TYPE_HOLDTIME:
|
case PIM_MSG_OPTION_TYPE_HOLDTIME:
|
||||||
@ -242,26 +211,18 @@ int pim_hello_recv(struct interface *ifp, struct in_addr src_addr,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PIM_MSG_OPTION_TYPE_DM_STATE_REFRESH:
|
case PIM_MSG_OPTION_TYPE_DM_STATE_REFRESH:
|
||||||
if (PIM_DEBUG_PIM_HELLO) {
|
if (PIM_DEBUG_PIM_HELLO)
|
||||||
char src_str[INET_ADDRSTRLEN];
|
|
||||||
pim_inet4_dump("<src?>", src_addr, src_str,
|
|
||||||
sizeof(src_str));
|
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"%s: ignoring PIM hello dense-mode state refresh TLV option type=%d length=%d from %s on interface %s",
|
"%s: ignoring PIM hello dense-mode state refresh TLV option type=%d length=%d from %pPAs on interface %s",
|
||||||
__func__, option_type, option_len,
|
__func__, option_type, option_len,
|
||||||
src_str, ifp->name);
|
&src_addr, ifp->name);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (PIM_DEBUG_PIM_HELLO) {
|
if (PIM_DEBUG_PIM_HELLO)
|
||||||
char src_str[INET_ADDRSTRLEN];
|
|
||||||
pim_inet4_dump("<src?>", src_addr, src_str,
|
|
||||||
sizeof(src_str));
|
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"%s: ignoring unknown PIM hello TLV type=%d length=%d from %s on interface %s",
|
"%s: ignoring unknown PIM hello TLV type=%d length=%d from %pPAs on interface %s",
|
||||||
__func__, option_type, option_len,
|
__func__, option_type, option_len,
|
||||||
src_str, ifp->name);
|
&src_addr, ifp->name);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tlv_curr += option_len;
|
tlv_curr += option_len;
|
||||||
@ -310,14 +271,10 @@ int pim_hello_recv(struct interface *ifp, struct in_addr src_addr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!PIM_OPTION_IS_SET(hello_options, PIM_OPTION_MASK_HOLDTIME)) {
|
if (!PIM_OPTION_IS_SET(hello_options, PIM_OPTION_MASK_HOLDTIME)) {
|
||||||
if (PIM_DEBUG_PIM_HELLO) {
|
if (PIM_DEBUG_PIM_HELLO)
|
||||||
char src_str[INET_ADDRSTRLEN];
|
|
||||||
pim_inet4_dump("<src?>", src_addr, src_str,
|
|
||||||
sizeof(src_str));
|
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"%s: PIM hello missing holdtime from %s on interface %s",
|
"%s: PIM hello missing holdtime from %pPAs on interface %s",
|
||||||
__func__, src_str, ifp->name);
|
__func__, &src_addr, ifp->name);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -335,14 +292,10 @@ int pim_hello_recv(struct interface *ifp, struct in_addr src_addr,
|
|||||||
hello_option_dr_priority, hello_option_generation_id,
|
hello_option_dr_priority, hello_option_generation_id,
|
||||||
hello_option_addr_list, PIM_NEIGHBOR_SEND_DELAY);
|
hello_option_addr_list, PIM_NEIGHBOR_SEND_DELAY);
|
||||||
if (!neigh) {
|
if (!neigh) {
|
||||||
if (PIM_DEBUG_PIM_HELLO) {
|
if (PIM_DEBUG_PIM_HELLO)
|
||||||
char src_str[INET_ADDRSTRLEN];
|
|
||||||
pim_inet4_dump("<src?>", src_addr, src_str,
|
|
||||||
sizeof(src_str));
|
|
||||||
zlog_warn(
|
zlog_warn(
|
||||||
"%s: failure creating PIM neighbor %s on interface %s",
|
"%s: failure creating PIM neighbor %pPAs on interface %s",
|
||||||
__func__, src_str, ifp->name);
|
__func__, &src_addr, ifp->name);
|
||||||
}
|
|
||||||
FREE_ADDR_LIST_THEN_RETURN(-8);
|
FREE_ADDR_LIST_THEN_RETURN(-8);
|
||||||
}
|
}
|
||||||
/* Forward BSM if required */
|
/* Forward BSM if required */
|
||||||
@ -368,16 +321,12 @@ int pim_hello_recv(struct interface *ifp, struct in_addr src_addr,
|
|||||||
|| (hello_option_generation_id != neigh->generation_id)) {
|
|| (hello_option_generation_id != neigh->generation_id)) {
|
||||||
/* GenID mismatch, then replace neighbor */
|
/* GenID mismatch, then replace neighbor */
|
||||||
|
|
||||||
if (PIM_DEBUG_PIM_HELLO) {
|
if (PIM_DEBUG_PIM_HELLO)
|
||||||
char src_str[INET_ADDRSTRLEN];
|
|
||||||
pim_inet4_dump("<src?>", src_addr, src_str,
|
|
||||||
sizeof(src_str));
|
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"%s: GenId mismatch new=%08x old=%08x: replacing neighbor %s on %s",
|
"%s: GenId mismatch new=%08x old=%08x: replacing neighbor %pPAs on %s",
|
||||||
__func__, hello_option_generation_id,
|
__func__, hello_option_generation_id,
|
||||||
neigh->generation_id, src_str,
|
neigh->generation_id, &src_addr,
|
||||||
ifp->name);
|
ifp->name);
|
||||||
}
|
|
||||||
|
|
||||||
pim_upstream_rpf_genid_changed(pim_ifp->pim,
|
pim_upstream_rpf_genid_changed(pim_ifp->pim,
|
||||||
neigh->source_addr);
|
neigh->source_addr);
|
||||||
@ -392,15 +341,10 @@ int pim_hello_recv(struct interface *ifp, struct in_addr src_addr,
|
|||||||
hello_option_addr_list,
|
hello_option_addr_list,
|
||||||
PIM_NEIGHBOR_SEND_NOW);
|
PIM_NEIGHBOR_SEND_NOW);
|
||||||
if (!neigh) {
|
if (!neigh) {
|
||||||
if (PIM_DEBUG_PIM_HELLO) {
|
if (PIM_DEBUG_PIM_HELLO)
|
||||||
char src_str[INET_ADDRSTRLEN];
|
|
||||||
pim_inet4_dump("<src?>", src_addr,
|
|
||||||
src_str,
|
|
||||||
sizeof(src_str));
|
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"%s: failure re-creating PIM neighbor %s on interface %s",
|
"%s: failure re-creating PIM neighbor %pPAs on interface %s",
|
||||||
__func__, src_str, ifp->name);
|
__func__, &src_addr, ifp->name);
|
||||||
}
|
|
||||||
FREE_ADDR_LIST_THEN_RETURN(-9);
|
FREE_ADDR_LIST_THEN_RETURN(-9);
|
||||||
}
|
}
|
||||||
/* Forward BSM if required */
|
/* Forward BSM if required */
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
|
|
||||||
#include "if.h"
|
#include "if.h"
|
||||||
|
|
||||||
int pim_hello_recv(struct interface *ifp, struct in_addr src_addr,
|
int pim_hello_recv(struct interface *ifp, pim_addr src_addr, uint8_t *tlv_buf,
|
||||||
uint8_t *tlv_buf, int tlv_buf_size);
|
int tlv_buf_size);
|
||||||
|
|
||||||
int pim_hello_build_tlv(struct interface *ifp, uint8_t *tlv_buf,
|
int pim_hello_build_tlv(struct interface *ifp, uint8_t *tlv_buf,
|
||||||
int tlv_buf_size, uint16_t holdtime,
|
int tlv_buf_size, uint16_t holdtime,
|
||||||
|
113
pimd/pim_tlv.c
113
pimd/pim_tlv.c
@ -290,15 +290,13 @@ uint8_t *pim_tlv_append_addrlist_ucast(uint8_t *buf, const uint8_t *buf_pastend,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int check_tlv_length(const char *label, const char *tlv_name,
|
static int check_tlv_length(const char *label, const char *tlv_name,
|
||||||
const char *ifname, struct in_addr src_addr,
|
const char *ifname, pim_addr src_addr,
|
||||||
int correct_len, int option_len)
|
int correct_len, int option_len)
|
||||||
{
|
{
|
||||||
if (option_len != correct_len) {
|
if (option_len != correct_len) {
|
||||||
char src_str[INET_ADDRSTRLEN];
|
|
||||||
pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
|
|
||||||
zlog_warn(
|
zlog_warn(
|
||||||
"%s: PIM hello %s TLV with incorrect value size=%d correct=%d from %s on interface %s",
|
"%s: PIM hello %s TLV with incorrect value size=%d correct=%d from %pPAs on interface %s",
|
||||||
label, tlv_name, option_len, correct_len, src_str,
|
label, tlv_name, option_len, correct_len, &src_addr,
|
||||||
ifname);
|
ifname);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -306,49 +304,44 @@ static int check_tlv_length(const char *label, const char *tlv_name,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_tlv_redefinition_uint16(
|
static void check_tlv_redefinition_uint16(const char *label,
|
||||||
const char *label, const char *tlv_name, const char *ifname,
|
const char *tlv_name,
|
||||||
struct in_addr src_addr, pim_hello_options options,
|
const char *ifname, pim_addr src_addr,
|
||||||
pim_hello_options opt_mask, uint16_t new, uint16_t old)
|
pim_hello_options options,
|
||||||
|
pim_hello_options opt_mask,
|
||||||
|
uint16_t new, uint16_t old)
|
||||||
{
|
{
|
||||||
if (PIM_OPTION_IS_SET(options, opt_mask)) {
|
if (PIM_OPTION_IS_SET(options, opt_mask))
|
||||||
char src_str[INET_ADDRSTRLEN];
|
|
||||||
pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
|
|
||||||
zlog_warn(
|
zlog_warn(
|
||||||
"%s: PIM hello TLV redefined %s=%u old=%u from %s on interface %s",
|
"%s: PIM hello TLV redefined %s=%u old=%u from %pPAs on interface %s",
|
||||||
label, tlv_name, new, old, src_str, ifname);
|
label, tlv_name, new, old, &src_addr, ifname);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_tlv_redefinition_uint32(
|
static void check_tlv_redefinition_uint32(const char *label,
|
||||||
const char *label, const char *tlv_name, const char *ifname,
|
const char *tlv_name,
|
||||||
struct in_addr src_addr, pim_hello_options options,
|
const char *ifname, pim_addr src_addr,
|
||||||
pim_hello_options opt_mask, uint32_t new, uint32_t old)
|
pim_hello_options options,
|
||||||
|
pim_hello_options opt_mask,
|
||||||
|
uint32_t new, uint32_t old)
|
||||||
{
|
{
|
||||||
if (PIM_OPTION_IS_SET(options, opt_mask)) {
|
if (PIM_OPTION_IS_SET(options, opt_mask))
|
||||||
char src_str[INET_ADDRSTRLEN];
|
|
||||||
pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
|
|
||||||
zlog_warn(
|
zlog_warn(
|
||||||
"%s: PIM hello TLV redefined %s=%u old=%u from %s on interface %s",
|
"%s: PIM hello TLV redefined %s=%u old=%u from %pPAs on interface %s",
|
||||||
label, tlv_name, new, old, src_str, ifname);
|
label, tlv_name, new, old, &src_addr, ifname);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_tlv_redefinition_uint32_hex(
|
static void check_tlv_redefinition_uint32_hex(
|
||||||
const char *label, const char *tlv_name, const char *ifname,
|
const char *label, const char *tlv_name, const char *ifname,
|
||||||
struct in_addr src_addr, pim_hello_options options,
|
pim_addr src_addr, pim_hello_options options,
|
||||||
pim_hello_options opt_mask, uint32_t new, uint32_t old)
|
pim_hello_options opt_mask, uint32_t new, uint32_t old)
|
||||||
{
|
{
|
||||||
if (PIM_OPTION_IS_SET(options, opt_mask)) {
|
if (PIM_OPTION_IS_SET(options, opt_mask))
|
||||||
char src_str[INET_ADDRSTRLEN];
|
|
||||||
pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
|
|
||||||
zlog_warn(
|
zlog_warn(
|
||||||
"%s: PIM hello TLV redefined %s=%08x old=%08x from %s on interface %s",
|
"%s: PIM hello TLV redefined %s=%08x old=%08x from %pPAs on interface %s",
|
||||||
label, tlv_name, new, old, src_str, ifname);
|
label, tlv_name, new, old, &src_addr, ifname);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int pim_tlv_parse_holdtime(const char *ifname, struct in_addr src_addr,
|
int pim_tlv_parse_holdtime(const char *ifname, pim_addr src_addr,
|
||||||
pim_hello_options *hello_options,
|
pim_hello_options *hello_options,
|
||||||
uint16_t *hello_option_holdtime, uint16_t option_len,
|
uint16_t *hello_option_holdtime, uint16_t option_len,
|
||||||
const uint8_t *tlv_curr)
|
const uint8_t *tlv_curr)
|
||||||
@ -372,7 +365,7 @@ int pim_tlv_parse_holdtime(const char *ifname, struct in_addr src_addr,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pim_tlv_parse_lan_prune_delay(const char *ifname, struct in_addr src_addr,
|
int pim_tlv_parse_lan_prune_delay(const char *ifname, pim_addr src_addr,
|
||||||
pim_hello_options *hello_options,
|
pim_hello_options *hello_options,
|
||||||
uint16_t *hello_option_propagation_delay,
|
uint16_t *hello_option_propagation_delay,
|
||||||
uint16_t *hello_option_override_interval,
|
uint16_t *hello_option_override_interval,
|
||||||
@ -408,7 +401,7 @@ int pim_tlv_parse_lan_prune_delay(const char *ifname, struct in_addr src_addr,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pim_tlv_parse_dr_priority(const char *ifname, struct in_addr src_addr,
|
int pim_tlv_parse_dr_priority(const char *ifname, pim_addr src_addr,
|
||||||
pim_hello_options *hello_options,
|
pim_hello_options *hello_options,
|
||||||
uint32_t *hello_option_dr_priority,
|
uint32_t *hello_option_dr_priority,
|
||||||
uint16_t option_len, const uint8_t *tlv_curr)
|
uint16_t option_len, const uint8_t *tlv_curr)
|
||||||
@ -432,7 +425,7 @@ int pim_tlv_parse_dr_priority(const char *ifname, struct in_addr src_addr,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pim_tlv_parse_generation_id(const char *ifname, struct in_addr src_addr,
|
int pim_tlv_parse_generation_id(const char *ifname, pim_addr src_addr,
|
||||||
pim_hello_options *hello_options,
|
pim_hello_options *hello_options,
|
||||||
uint32_t *hello_option_generation_id,
|
uint32_t *hello_option_generation_id,
|
||||||
uint16_t option_len, const uint8_t *tlv_curr)
|
uint16_t option_len, const uint8_t *tlv_curr)
|
||||||
@ -682,7 +675,7 @@ int pim_parse_addr_source(pim_sgaddr *sg, uint8_t *flags, const uint8_t *buf,
|
|||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
int pim_tlv_parse_addr_list(const char *ifname, struct in_addr src_addr,
|
int pim_tlv_parse_addr_list(const char *ifname, pim_addr src_addr,
|
||||||
pim_hello_options *hello_options,
|
pim_hello_options *hello_options,
|
||||||
struct list **hello_option_addr_list,
|
struct list **hello_option_addr_list,
|
||||||
uint16_t option_len, const uint8_t *tlv_curr)
|
uint16_t option_len, const uint8_t *tlv_curr)
|
||||||
@ -698,7 +691,7 @@ int pim_tlv_parse_addr_list(const char *ifname, struct in_addr src_addr,
|
|||||||
addr = tlv_curr;
|
addr = tlv_curr;
|
||||||
pastend = tlv_curr + option_len;
|
pastend = tlv_curr + option_len;
|
||||||
while (addr < pastend) {
|
while (addr < pastend) {
|
||||||
struct prefix tmp;
|
struct prefix tmp, src_pfx;
|
||||||
int addr_offset;
|
int addr_offset;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -707,12 +700,9 @@ int pim_tlv_parse_addr_list(const char *ifname, struct in_addr src_addr,
|
|||||||
addr_offset =
|
addr_offset =
|
||||||
pim_parse_addr_ucast_prefix(&tmp, addr, pastend - addr);
|
pim_parse_addr_ucast_prefix(&tmp, addr, pastend - addr);
|
||||||
if (addr_offset < 1) {
|
if (addr_offset < 1) {
|
||||||
char src_str[INET_ADDRSTRLEN];
|
|
||||||
pim_inet4_dump("<src?>", src_addr, src_str,
|
|
||||||
sizeof(src_str));
|
|
||||||
zlog_warn(
|
zlog_warn(
|
||||||
"%s: pim_parse_addr_ucast() failure: from %s on %s",
|
"%s: pim_parse_addr_ucast() failure: from %pPAs on %s",
|
||||||
__func__, src_str, ifname);
|
__func__, &src_addr, ifname);
|
||||||
FREE_ADDR_LIST(*hello_option_addr_list);
|
FREE_ADDR_LIST(*hello_option_addr_list);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -725,35 +715,28 @@ int pim_tlv_parse_addr_list(const char *ifname, struct in_addr src_addr,
|
|||||||
switch (tmp.family) {
|
switch (tmp.family) {
|
||||||
case AF_INET: {
|
case AF_INET: {
|
||||||
char addr_str[INET_ADDRSTRLEN];
|
char addr_str[INET_ADDRSTRLEN];
|
||||||
char src_str[INET_ADDRSTRLEN];
|
|
||||||
pim_inet4_dump("<addr?>", tmp.u.prefix4,
|
pim_inet4_dump("<addr?>", tmp.u.prefix4,
|
||||||
addr_str, sizeof(addr_str));
|
addr_str, sizeof(addr_str));
|
||||||
pim_inet4_dump("<src?>", src_addr, src_str,
|
|
||||||
sizeof(src_str));
|
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"%s: PIM hello TLV option: list_old_size=%d IPv4 address %s from %s on %s",
|
"%s: PIM hello TLV option: list_old_size=%d IPv4 address %s from %pPAs on %s",
|
||||||
__func__,
|
__func__,
|
||||||
*hello_option_addr_list
|
*hello_option_addr_list
|
||||||
? ((int)listcount(
|
? ((int)listcount(
|
||||||
*hello_option_addr_list))
|
*hello_option_addr_list))
|
||||||
: -1,
|
: -1,
|
||||||
addr_str, src_str, ifname);
|
addr_str, &src_addr, ifname);
|
||||||
} break;
|
} break;
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
break;
|
break;
|
||||||
default: {
|
default:
|
||||||
char src_str[INET_ADDRSTRLEN];
|
|
||||||
pim_inet4_dump("<src?>", src_addr, src_str,
|
|
||||||
sizeof(src_str));
|
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"%s: PIM hello TLV option: list_old_size=%d UNKNOWN address family from %s on %s",
|
"%s: PIM hello TLV option: list_old_size=%d UNKNOWN address family from %pPAs on %s",
|
||||||
__func__,
|
__func__,
|
||||||
*hello_option_addr_list
|
*hello_option_addr_list
|
||||||
? ((int)listcount(
|
? ((int)listcount(
|
||||||
*hello_option_addr_list))
|
*hello_option_addr_list))
|
||||||
: -1,
|
: -1,
|
||||||
src_str, ifname);
|
&src_addr, ifname);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -761,16 +744,12 @@ int pim_tlv_parse_addr_list(const char *ifname, struct in_addr src_addr,
|
|||||||
Exclude neighbor's primary address if incorrectly included in
|
Exclude neighbor's primary address if incorrectly included in
|
||||||
the secondary address list
|
the secondary address list
|
||||||
*/
|
*/
|
||||||
if (tmp.family == AF_INET) {
|
pim_addr_to_prefix(&src_pfx, src_addr);
|
||||||
if (tmp.u.prefix4.s_addr == src_addr.s_addr) {
|
if (!prefix_cmp(&tmp, &src_pfx)) {
|
||||||
char src_str[INET_ADDRSTRLEN];
|
zlog_warn(
|
||||||
pim_inet4_dump("<src?>", src_addr, src_str,
|
"%s: ignoring primary address in secondary list from %pPAs on %s",
|
||||||
sizeof(src_str));
|
__func__, &src_addr, ifname);
|
||||||
zlog_warn(
|
continue;
|
||||||
"%s: ignoring primary address in secondary list from %s on %s",
|
|
||||||
__func__, src_str, ifname);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -84,24 +84,24 @@ uint8_t *pim_tlv_append_uint32(uint8_t *buf, const uint8_t *buf_pastend,
|
|||||||
uint8_t *pim_tlv_append_addrlist_ucast(uint8_t *buf, const uint8_t *buf_pastend,
|
uint8_t *pim_tlv_append_addrlist_ucast(uint8_t *buf, const uint8_t *buf_pastend,
|
||||||
struct list *ifconnected, int family);
|
struct list *ifconnected, int family);
|
||||||
|
|
||||||
int pim_tlv_parse_holdtime(const char *ifname, struct in_addr src_addr,
|
int pim_tlv_parse_holdtime(const char *ifname, pim_addr src_addr,
|
||||||
pim_hello_options *hello_options,
|
pim_hello_options *hello_options,
|
||||||
uint16_t *hello_option_holdtime, uint16_t option_len,
|
uint16_t *hello_option_holdtime, uint16_t option_len,
|
||||||
const uint8_t *tlv_curr);
|
const uint8_t *tlv_curr);
|
||||||
int pim_tlv_parse_lan_prune_delay(const char *ifname, struct in_addr src_addr,
|
int pim_tlv_parse_lan_prune_delay(const char *ifname, pim_addr src_addr,
|
||||||
pim_hello_options *hello_options,
|
pim_hello_options *hello_options,
|
||||||
uint16_t *hello_option_propagation_delay,
|
uint16_t *hello_option_propagation_delay,
|
||||||
uint16_t *hello_option_override_interval,
|
uint16_t *hello_option_override_interval,
|
||||||
uint16_t option_len, const uint8_t *tlv_curr);
|
uint16_t option_len, const uint8_t *tlv_curr);
|
||||||
int pim_tlv_parse_dr_priority(const char *ifname, struct in_addr src_addr,
|
int pim_tlv_parse_dr_priority(const char *ifname, pim_addr src_addr,
|
||||||
pim_hello_options *hello_options,
|
pim_hello_options *hello_options,
|
||||||
uint32_t *hello_option_dr_priority,
|
uint32_t *hello_option_dr_priority,
|
||||||
uint16_t option_len, const uint8_t *tlv_curr);
|
uint16_t option_len, const uint8_t *tlv_curr);
|
||||||
int pim_tlv_parse_generation_id(const char *ifname, struct in_addr src_addr,
|
int pim_tlv_parse_generation_id(const char *ifname, pim_addr src_addr,
|
||||||
pim_hello_options *hello_options,
|
pim_hello_options *hello_options,
|
||||||
uint32_t *hello_option_generation_id,
|
uint32_t *hello_option_generation_id,
|
||||||
uint16_t option_len, const uint8_t *tlv_curr);
|
uint16_t option_len, const uint8_t *tlv_curr);
|
||||||
int pim_tlv_parse_addr_list(const char *ifname, struct in_addr src_addr,
|
int pim_tlv_parse_addr_list(const char *ifname, pim_addr src_addr,
|
||||||
pim_hello_options *hello_options,
|
pim_hello_options *hello_options,
|
||||||
struct list **hello_option_addr_list,
|
struct list **hello_option_addr_list,
|
||||||
uint16_t option_len, const uint8_t *tlv_curr);
|
uint16_t option_len, const uint8_t *tlv_curr);
|
||||||
|
Loading…
Reference in New Issue
Block a user