mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-11 18:48:14 +00:00
Merge pull request #1307 from vjardin6WIND/clean
Fix many clang warning
This commit is contained in:
commit
40aa03ebde
@ -410,8 +410,8 @@ DEFUN (ip_as_path,
|
|||||||
char *regstr;
|
char *regstr;
|
||||||
|
|
||||||
/* Retrieve access list name */
|
/* Retrieve access list name */
|
||||||
char *alname =
|
argv_find(argv, argc, "WORD", &idx);
|
||||||
argv_find(argv, argc, "WORD", &idx) ? argv[idx]->arg : NULL;
|
char *alname = argv[idx]->arg;
|
||||||
|
|
||||||
/* Check the filter type. */
|
/* Check the filter type. */
|
||||||
type = argv_find(argv, argc, "deny", &idx) ? AS_FILTER_DENY
|
type = argv_find(argv, argc, "deny", &idx) ? AS_FILTER_DENY
|
||||||
|
@ -225,7 +225,6 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr,
|
|||||||
for (; pnt < lim; pnt += psize) {
|
for (; pnt < lim; pnt += psize) {
|
||||||
/* Clear prefix structure. */
|
/* Clear prefix structure. */
|
||||||
memset(&p, 0, sizeof(struct prefix));
|
memset(&p, 0, sizeof(struct prefix));
|
||||||
llen = 0;
|
|
||||||
|
|
||||||
if (addpath_encoded) {
|
if (addpath_encoded) {
|
||||||
|
|
||||||
|
@ -3861,6 +3861,20 @@ void rfapiBgpInfoFilteredImportVPN(
|
|||||||
VNC_ITRCCK;
|
VNC_ITRCCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void rfapiBgpInfoFilteredImportBadSafi(
|
||||||
|
struct rfapi_import_table *import_table, int action, struct peer *peer,
|
||||||
|
void *rfd, /* set for looped back routes */
|
||||||
|
struct prefix *p,
|
||||||
|
struct prefix *aux_prefix, /* AFI_L2VPN: optional IP */
|
||||||
|
afi_t afi, struct prefix_rd *prd,
|
||||||
|
struct attr *attr, /* part of bgp_info */
|
||||||
|
u_char type, /* part of bgp_info */
|
||||||
|
u_char sub_type, /* part of bgp_info */
|
||||||
|
uint32_t *label) /* part of bgp_info */
|
||||||
|
{
|
||||||
|
vnc_zlog_debug_verbose("%s: Error, bad safi", __func__);
|
||||||
|
}
|
||||||
|
|
||||||
static rfapi_bi_filtered_import_f *
|
static rfapi_bi_filtered_import_f *
|
||||||
rfapiBgpInfoFilteredImportFunction(safi_t safi)
|
rfapiBgpInfoFilteredImportFunction(safi_t safi)
|
||||||
{
|
{
|
||||||
@ -3874,7 +3888,7 @@ rfapiBgpInfoFilteredImportFunction(safi_t safi)
|
|||||||
default:
|
default:
|
||||||
/* not expected */
|
/* not expected */
|
||||||
zlog_err("%s: bad safi %d", __func__, safi);
|
zlog_err("%s: bad safi %d", __func__, safi);
|
||||||
return NULL;
|
return rfapiBgpInfoFilteredImportBadSafi;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1378,6 +1378,8 @@ struct route_node *rfapiMonitorEthAdd(struct bgp *bgp,
|
|||||||
#if DEBUG_L2_EXTRA
|
#if DEBUG_L2_EXTRA
|
||||||
vnc_zlog_debug_verbose("%s: inserted rfd=%p mon_eth=%p, rc=%d",
|
vnc_zlog_debug_verbose("%s: inserted rfd=%p mon_eth=%p, rc=%d",
|
||||||
__func__, rfd, val, rc);
|
__func__, rfd, val, rc);
|
||||||
|
#else
|
||||||
|
(void)rc;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -187,6 +187,7 @@ void eigrp_distribute_update(struct distribute *dist)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
assert(ei != NULL);
|
||||||
|
|
||||||
/* Access-list for interface in */
|
/* Access-list for interface in */
|
||||||
if (dist->list[DISTRIBUTE_V4_IN]) {
|
if (dist->list[DISTRIBUTE_V4_IN]) {
|
||||||
|
@ -169,7 +169,7 @@ int eigrp_check_md5_digest(struct stream *s,
|
|||||||
struct TLV_MD5_Authentication_Type *auth_TLV;
|
struct TLV_MD5_Authentication_Type *auth_TLV;
|
||||||
struct eigrp_header *eigrph;
|
struct eigrp_header *eigrph;
|
||||||
|
|
||||||
if (nbr && ntohl(nbr->crypt_seqnum) > ntohl(authTLV->key_sequence)) {
|
if (ntohl(nbr->crypt_seqnum) > ntohl(authTLV->key_sequence)) {
|
||||||
zlog_warn(
|
zlog_warn(
|
||||||
"interface %s: eigrp_check_md5 bad sequence %d (expect %d)",
|
"interface %s: eigrp_check_md5 bad sequence %d (expect %d)",
|
||||||
IF_NAME(nbr->ei), ntohl(authTLV->key_sequence),
|
IF_NAME(nbr->ei), ntohl(authTLV->key_sequence),
|
||||||
@ -317,7 +317,6 @@ int eigrp_write(struct thread *thread)
|
|||||||
struct ip iph;
|
struct ip iph;
|
||||||
struct msghdr msg;
|
struct msghdr msg;
|
||||||
struct iovec iov[2];
|
struct iovec iov[2];
|
||||||
u_int16_t opcode = 0;
|
|
||||||
u_int32_t seqno, ack;
|
u_int32_t seqno, ack;
|
||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
@ -363,7 +362,6 @@ int eigrp_write(struct thread *thread)
|
|||||||
* this outgoing packet.
|
* this outgoing packet.
|
||||||
*/
|
*/
|
||||||
eigrph = (struct eigrp_header *)STREAM_DATA(ep->s);
|
eigrph = (struct eigrp_header *)STREAM_DATA(ep->s);
|
||||||
opcode = eigrph->opcode;
|
|
||||||
seqno = ntohl(eigrph->sequence);
|
seqno = ntohl(eigrph->sequence);
|
||||||
ack = ntohl(eigrph->ack);
|
ack = ntohl(eigrph->ack);
|
||||||
if (ep->nbr && (ack != ep->nbr->recv_sequence_number)) {
|
if (ep->nbr && (ack != ep->nbr->recv_sequence_number)) {
|
||||||
@ -427,9 +425,8 @@ int eigrp_write(struct thread *thread)
|
|||||||
|
|
||||||
if (IS_DEBUG_EIGRP_TRANSMIT(0, SEND)) {
|
if (IS_DEBUG_EIGRP_TRANSMIT(0, SEND)) {
|
||||||
eigrph = (struct eigrp_header *)STREAM_DATA(ep->s);
|
eigrph = (struct eigrp_header *)STREAM_DATA(ep->s);
|
||||||
opcode = eigrph->opcode;
|
|
||||||
zlog_debug("Sending [%s][%d/%d] to [%s] via [%s] ret [%d].",
|
zlog_debug("Sending [%s][%d/%d] to [%s] via [%s] ret [%d].",
|
||||||
lookup_msg(eigrp_packet_type_str, opcode, NULL),
|
lookup_msg(eigrp_packet_type_str, eigrph->opcode, NULL),
|
||||||
seqno, ack,
|
seqno, ack,
|
||||||
inet_ntoa(ep->dst), IF_NAME(ei), ret);
|
inet_ntoa(ep->dst), IF_NAME(ei), ret);
|
||||||
}
|
}
|
||||||
|
@ -223,6 +223,9 @@ uint8_t add_te_subtlvs(uint8_t *buf, struct mpls_te_circuit *mtc)
|
|||||||
tlvs += size;
|
tlvs += size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Add before this line any other parsing of TLV */
|
||||||
|
(void)tlvs;
|
||||||
|
|
||||||
/* Update SubTLVs length */
|
/* Update SubTLVs length */
|
||||||
mtc->length = subtlvs_len(mtc);
|
mtc->length = subtlvs_len(mtc);
|
||||||
|
|
||||||
|
@ -88,6 +88,7 @@ send_address(struct nbr *nbr, int af, struct if_addr_head *addr_list,
|
|||||||
err |= gen_msg_hdr(buf, msg_type, size);
|
err |= gen_msg_hdr(buf, msg_type, size);
|
||||||
size -= LDP_MSG_SIZE;
|
size -= LDP_MSG_SIZE;
|
||||||
err |= gen_address_list_tlv(buf, af, addr_list, tlv_addr_count);
|
err |= gen_address_list_tlv(buf, af, addr_list, tlv_addr_count);
|
||||||
|
(void)size;
|
||||||
if (err) {
|
if (err) {
|
||||||
address_list_clr(addr_list);
|
address_list_clr(addr_list);
|
||||||
ibuf_free(buf);
|
ibuf_free(buf);
|
||||||
|
@ -330,7 +330,7 @@ int ptm_lib_process_msg(ptm_lib_handle_t *hdl, int fd, char *inbuf, int inlen,
|
|||||||
char client_name[32];
|
char client_name[32];
|
||||||
int cmd_id, type, ver, msglen;
|
int cmd_id, type, ver, msglen;
|
||||||
csv_t *csv;
|
csv_t *csv;
|
||||||
ptm_lib_msg_ctxt_t *p_ctxt;
|
ptm_lib_msg_ctxt_t *p_ctxt = NULL;
|
||||||
|
|
||||||
len = _ptm_lib_read_ptm_socket(fd, inbuf, PTMLIB_MSG_HDR_LEN);
|
len = _ptm_lib_read_ptm_socket(fd, inbuf, PTMLIB_MSG_HDR_LEN);
|
||||||
if (len <= 0)
|
if (len <= 0)
|
||||||
|
@ -1110,19 +1110,21 @@ void install_element_ospf6_debug_abr(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct ospf6_lsa_handler inter_prefix_handler = {
|
struct ospf6_lsa_handler inter_prefix_handler = {
|
||||||
OSPF6_LSTYPE_INTER_PREFIX,
|
.lh_type = OSPF6_LSTYPE_INTER_PREFIX,
|
||||||
"Inter-Prefix",
|
.lh_name = "Inter-Prefix",
|
||||||
"IAP",
|
.lh_short_name = "IAP",
|
||||||
ospf6_inter_area_prefix_lsa_show,
|
.lh_show = ospf6_inter_area_prefix_lsa_show,
|
||||||
ospf6_inter_area_prefix_lsa_get_prefix_str,
|
.lh_get_prefix_str = ospf6_inter_area_prefix_lsa_get_prefix_str,
|
||||||
|
.lh_debug = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ospf6_lsa_handler inter_router_handler = {
|
struct ospf6_lsa_handler inter_router_handler = {
|
||||||
OSPF6_LSTYPE_INTER_ROUTER,
|
.lh_type = OSPF6_LSTYPE_INTER_ROUTER,
|
||||||
"Inter-Router",
|
.lh_name = "Inter-Router",
|
||||||
"IAR",
|
.lh_short_name = "IAR",
|
||||||
ospf6_inter_area_router_lsa_show,
|
.lh_show = ospf6_inter_area_router_lsa_show,
|
||||||
ospf6_inter_area_router_lsa_get_prefix_str,
|
.lh_get_prefix_str = ospf6_inter_area_router_lsa_get_prefix_str,
|
||||||
|
.lh_debug = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
void ospf6_abr_init(void)
|
void ospf6_abr_init(void)
|
||||||
|
@ -438,6 +438,9 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,
|
|||||||
if (!ospf6_zebra_is_redistribute(type))
|
if (!ospf6_zebra_is_redistribute(type))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
memset(&troute, 0, sizeof(troute));
|
||||||
|
memset(&tinfo, 0, sizeof(tinfo));
|
||||||
|
|
||||||
if (IS_OSPF6_DEBUG_ASBR) {
|
if (IS_OSPF6_DEBUG_ASBR) {
|
||||||
prefix2str(prefix, pbuf, sizeof(pbuf));
|
prefix2str(prefix, pbuf, sizeof(pbuf));
|
||||||
zlog_debug("Redistribute %s (%s)", pbuf, ZROUTE_NAME(type));
|
zlog_debug("Redistribute %s (%s)", pbuf, ZROUTE_NAME(type));
|
||||||
@ -457,8 +460,6 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,
|
|||||||
|
|
||||||
/* apply route-map */
|
/* apply route-map */
|
||||||
if (ospf6->rmap[type].map) {
|
if (ospf6->rmap[type].map) {
|
||||||
memset(&troute, 0, sizeof(troute));
|
|
||||||
memset(&tinfo, 0, sizeof(tinfo));
|
|
||||||
troute.route_option = &tinfo;
|
troute.route_option = &tinfo;
|
||||||
tinfo.ifindex = ifindex;
|
tinfo.ifindex = ifindex;
|
||||||
tinfo.tag = tag;
|
tinfo.tag = tag;
|
||||||
@ -1234,8 +1235,13 @@ DEFUN (show_ipv6_ospf6_redistribute,
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct ospf6_lsa_handler as_external_handler = {
|
struct ospf6_lsa_handler as_external_handler = {
|
||||||
OSPF6_LSTYPE_AS_EXTERNAL, "AS-External", "ASE",
|
.lh_type = OSPF6_LSTYPE_AS_EXTERNAL,
|
||||||
ospf6_as_external_lsa_show, ospf6_as_external_lsa_get_prefix_str};
|
.lh_name = "AS-External",
|
||||||
|
.lh_short_name = "ASE",
|
||||||
|
.lh_show = ospf6_as_external_lsa_show,
|
||||||
|
.lh_get_prefix_str = ospf6_as_external_lsa_get_prefix_str,
|
||||||
|
.lh_debug = 0
|
||||||
|
};
|
||||||
|
|
||||||
void ospf6_asbr_init(void)
|
void ospf6_asbr_init(void)
|
||||||
{
|
{
|
||||||
|
@ -1630,21 +1630,41 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa)
|
|||||||
oa->name);
|
oa->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ospf6_lsa_handler router_handler = {OSPF6_LSTYPE_ROUTER, "Router", "Rtr",
|
struct ospf6_lsa_handler router_handler = {
|
||||||
ospf6_router_lsa_show,
|
.lh_type = OSPF6_LSTYPE_ROUTER,
|
||||||
ospf6_router_lsa_get_nbr_id};
|
.lh_name = "Router",
|
||||||
|
.lh_short_name = "Rtr",
|
||||||
|
.lh_show = ospf6_router_lsa_show,
|
||||||
|
.lh_get_prefix_str = ospf6_router_lsa_get_nbr_id,
|
||||||
|
.lh_debug = 0
|
||||||
|
};
|
||||||
|
|
||||||
struct ospf6_lsa_handler network_handler = {OSPF6_LSTYPE_NETWORK, "Network",
|
struct ospf6_lsa_handler network_handler = {
|
||||||
"Net", ospf6_network_lsa_show,
|
.lh_type = OSPF6_LSTYPE_NETWORK,
|
||||||
ospf6_network_lsa_get_ar_id};
|
.lh_name = "Network",
|
||||||
|
.lh_short_name = "Net",
|
||||||
|
.lh_show = ospf6_network_lsa_show,
|
||||||
|
.lh_get_prefix_str = ospf6_network_lsa_get_ar_id,
|
||||||
|
.lh_debug = 0
|
||||||
|
};
|
||||||
|
|
||||||
struct ospf6_lsa_handler link_handler = {OSPF6_LSTYPE_LINK, "Link", "Lnk",
|
struct ospf6_lsa_handler link_handler = {
|
||||||
ospf6_link_lsa_show,
|
.lh_type = OSPF6_LSTYPE_LINK,
|
||||||
ospf6_link_lsa_get_prefix_str};
|
.lh_name = "Link",
|
||||||
|
.lh_short_name = "Lnk",
|
||||||
|
.lh_show = ospf6_link_lsa_show,
|
||||||
|
.lh_get_prefix_str = ospf6_link_lsa_get_prefix_str,
|
||||||
|
.lh_debug = 0
|
||||||
|
};
|
||||||
|
|
||||||
struct ospf6_lsa_handler intra_prefix_handler = {
|
struct ospf6_lsa_handler intra_prefix_handler = {
|
||||||
OSPF6_LSTYPE_INTRA_PREFIX, "Intra-Prefix", "INP",
|
.lh_type = OSPF6_LSTYPE_INTRA_PREFIX,
|
||||||
ospf6_intra_prefix_lsa_show, ospf6_intra_prefix_lsa_get_prefix_str};
|
.lh_name = "Intra-Prefix",
|
||||||
|
.lh_short_name = "INP",
|
||||||
|
.lh_show = ospf6_intra_prefix_lsa_show,
|
||||||
|
.lh_get_prefix_str = ospf6_intra_prefix_lsa_get_prefix_str,
|
||||||
|
.lh_debug = 0
|
||||||
|
};
|
||||||
|
|
||||||
void ospf6_intra_init(void)
|
void ospf6_intra_init(void)
|
||||||
{
|
{
|
||||||
|
@ -68,19 +68,25 @@ static int ospf6_unknown_lsa_show(struct vty *vty, struct ospf6_lsa *lsa)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ospf6_lsa_handler unknown_handler = {
|
static struct ospf6_lsa_handler unknown_handler = {
|
||||||
OSPF6_LSTYPE_UNKNOWN, "Unknown", "Unk", ospf6_unknown_lsa_show, NULL};
|
.lh_type = OSPF6_LSTYPE_UNKNOWN,
|
||||||
|
.lh_name = "Unknown",
|
||||||
|
.lh_short_name = "Unk",
|
||||||
|
.lh_show = ospf6_unknown_lsa_show,
|
||||||
|
.lh_get_prefix_str = NULL,
|
||||||
|
.lh_debug = 0 /* No default debug */
|
||||||
|
};
|
||||||
|
|
||||||
void ospf6_install_lsa_handler(struct ospf6_lsa_handler *handler)
|
void ospf6_install_lsa_handler(const struct ospf6_lsa_handler *handler)
|
||||||
{
|
{
|
||||||
/* type in handler is host byte order */
|
/* type in handler is host byte order */
|
||||||
int index = handler->type & OSPF6_LSTYPE_FCODE_MASK;
|
int index = handler->lh_type & OSPF6_LSTYPE_FCODE_MASK;
|
||||||
vector_set_index(ospf6_lsa_handler_vector, index, handler);
|
vector_set_index(ospf6_lsa_handler_vector, index, (void *)handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ospf6_lsa_handler *ospf6_get_lsa_handler(u_int16_t type)
|
const struct ospf6_lsa_handler *ospf6_get_lsa_handler(u_int16_t type)
|
||||||
{
|
{
|
||||||
struct ospf6_lsa_handler *handler = NULL;
|
const struct ospf6_lsa_handler *handler = NULL;
|
||||||
unsigned int index = ntohs(type) & OSPF6_LSTYPE_FCODE_MASK;
|
unsigned int index = ntohs(type) & OSPF6_LSTYPE_FCODE_MASK;
|
||||||
|
|
||||||
if (index >= vector_active(ospf6_lsa_handler_vector))
|
if (index >= vector_active(ospf6_lsa_handler_vector))
|
||||||
@ -97,11 +103,11 @@ struct ospf6_lsa_handler *ospf6_get_lsa_handler(u_int16_t type)
|
|||||||
const char *ospf6_lstype_name(u_int16_t type)
|
const char *ospf6_lstype_name(u_int16_t type)
|
||||||
{
|
{
|
||||||
static char buf[8];
|
static char buf[8];
|
||||||
struct ospf6_lsa_handler *handler;
|
const struct ospf6_lsa_handler *handler;
|
||||||
|
|
||||||
handler = ospf6_get_lsa_handler(type);
|
handler = ospf6_get_lsa_handler(type);
|
||||||
if (handler && handler != &unknown_handler)
|
if (handler && handler != &unknown_handler)
|
||||||
return handler->name;
|
return handler->lh_name;
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "0x%04hx", ntohs(type));
|
snprintf(buf, sizeof(buf), "0x%04hx", ntohs(type));
|
||||||
return buf;
|
return buf;
|
||||||
@ -110,11 +116,11 @@ const char *ospf6_lstype_name(u_int16_t type)
|
|||||||
const char *ospf6_lstype_short_name(u_int16_t type)
|
const char *ospf6_lstype_short_name(u_int16_t type)
|
||||||
{
|
{
|
||||||
static char buf[8];
|
static char buf[8];
|
||||||
struct ospf6_lsa_handler *handler;
|
const struct ospf6_lsa_handler *handler;
|
||||||
|
|
||||||
handler = ospf6_get_lsa_handler(type);
|
handler = ospf6_get_lsa_handler(type);
|
||||||
if (handler && handler != &unknown_handler)
|
if (handler && handler != &unknown_handler)
|
||||||
return handler->short_name;
|
return handler->lh_short_name;
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "0x%04hx", ntohs(type));
|
snprintf(buf, sizeof(buf), "0x%04hx", ntohs(type));
|
||||||
return buf;
|
return buf;
|
||||||
@ -122,7 +128,7 @@ const char *ospf6_lstype_short_name(u_int16_t type)
|
|||||||
|
|
||||||
u_char ospf6_lstype_debug(u_int16_t type)
|
u_char ospf6_lstype_debug(u_int16_t type)
|
||||||
{
|
{
|
||||||
struct ospf6_lsa_handler *handler;
|
const struct ospf6_lsa_handler *handler;
|
||||||
handler = ospf6_get_lsa_handler(type);
|
handler = ospf6_get_lsa_handler(type);
|
||||||
return handler->debug;
|
return handler->debug;
|
||||||
}
|
}
|
||||||
@ -369,7 +375,7 @@ void ospf6_lsa_show_summary(struct vty *vty, struct ospf6_lsa *lsa)
|
|||||||
{
|
{
|
||||||
char adv_router[16], id[16];
|
char adv_router[16], id[16];
|
||||||
int type;
|
int type;
|
||||||
struct ospf6_lsa_handler *handler;
|
const struct ospf6_lsa_handler *handler;
|
||||||
char buf[64], tmpbuf[80];
|
char buf[64], tmpbuf[80];
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
|
|
||||||
@ -389,14 +395,14 @@ void ospf6_lsa_show_summary(struct vty *vty, struct ospf6_lsa *lsa)
|
|||||||
ospf6_lstype_short_name(lsa->header->type), id,
|
ospf6_lstype_short_name(lsa->header->type), id,
|
||||||
adv_router, ospf6_lsa_age_current(lsa),
|
adv_router, ospf6_lsa_age_current(lsa),
|
||||||
(u_long)ntohl(lsa->header->seqnum),
|
(u_long)ntohl(lsa->header->seqnum),
|
||||||
handler->get_prefix_str(lsa, buf, sizeof(buf), 0));
|
handler->lh_get_prefix_str(lsa, buf, sizeof(buf), 0));
|
||||||
} else if (type != OSPF6_LSTYPE_UNKNOWN) {
|
} else if (type != OSPF6_LSTYPE_UNKNOWN) {
|
||||||
sprintf(tmpbuf, "%-4s %-15s%-15s%4hu %8lx",
|
sprintf(tmpbuf, "%-4s %-15s%-15s%4hu %8lx",
|
||||||
ospf6_lstype_short_name(lsa->header->type), id,
|
ospf6_lstype_short_name(lsa->header->type), id,
|
||||||
adv_router, ospf6_lsa_age_current(lsa),
|
adv_router, ospf6_lsa_age_current(lsa),
|
||||||
(u_long)ntohl(lsa->header->seqnum));
|
(u_long)ntohl(lsa->header->seqnum));
|
||||||
|
|
||||||
while (handler->get_prefix_str(lsa, buf, sizeof(buf), cnt)
|
while (handler->lh_get_prefix_str(lsa, buf, sizeof(buf), cnt)
|
||||||
!= NULL) {
|
!= NULL) {
|
||||||
vty_out(vty, "%s %30s\n", tmpbuf, buf);
|
vty_out(vty, "%s %30s\n", tmpbuf, buf);
|
||||||
cnt++;
|
cnt++;
|
||||||
@ -465,7 +471,7 @@ void ospf6_lsa_show_internal(struct vty *vty, struct ospf6_lsa *lsa)
|
|||||||
void ospf6_lsa_show(struct vty *vty, struct ospf6_lsa *lsa)
|
void ospf6_lsa_show(struct vty *vty, struct ospf6_lsa *lsa)
|
||||||
{
|
{
|
||||||
char adv_router[64], id[64];
|
char adv_router[64], id[64];
|
||||||
struct ospf6_lsa_handler *handler;
|
const struct ospf6_lsa_handler *handler;
|
||||||
struct timeval now, res;
|
struct timeval now, res;
|
||||||
char duration[64];
|
char duration[64];
|
||||||
|
|
||||||
@ -490,9 +496,13 @@ void ospf6_lsa_show(struct vty *vty, struct ospf6_lsa *lsa)
|
|||||||
vty_out(vty, "Duration: %s\n", duration);
|
vty_out(vty, "Duration: %s\n", duration);
|
||||||
|
|
||||||
handler = ospf6_get_lsa_handler(lsa->header->type);
|
handler = ospf6_get_lsa_handler(lsa->header->type);
|
||||||
if (handler->show == NULL)
|
|
||||||
handler = &unknown_handler;
|
if (handler->lh_show != NULL)
|
||||||
(*handler->show)(vty, lsa);
|
handler->lh_show(vty, lsa);
|
||||||
|
else {
|
||||||
|
assert(unknown_handler.lh_show != NULL);
|
||||||
|
unknown_handler.lh_show(vty, lsa);
|
||||||
|
}
|
||||||
|
|
||||||
vty_out(vty, "\n");
|
vty_out(vty, "\n");
|
||||||
}
|
}
|
||||||
@ -739,22 +749,22 @@ void ospf6_lsa_terminate(void)
|
|||||||
vector_free(ospf6_lsa_handler_vector);
|
vector_free(ospf6_lsa_handler_vector);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *ospf6_lsa_handler_name(struct ospf6_lsa_handler *h)
|
static char *ospf6_lsa_handler_name(const struct ospf6_lsa_handler *h)
|
||||||
{
|
{
|
||||||
static char buf[64];
|
static char buf[64];
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int size = strlen(h->name);
|
unsigned int size = strlen(h->lh_name);
|
||||||
|
|
||||||
if (!strcmp(h->name, "unknown") && h->type != OSPF6_LSTYPE_UNKNOWN) {
|
if (!strcmp(h->lh_name, "unknown") && h->lh_type != OSPF6_LSTYPE_UNKNOWN) {
|
||||||
snprintf(buf, sizeof(buf), "%#04hx", h->type);
|
snprintf(buf, sizeof(buf), "%#04hx", h->lh_type);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < MIN(size, sizeof(buf)); i++) {
|
for (i = 0; i < MIN(size, sizeof(buf)); i++) {
|
||||||
if (!islower((unsigned char)h->name[i]))
|
if (!islower((unsigned char)h->lh_name[i]))
|
||||||
buf[i] = tolower((unsigned char)h->name[i]);
|
buf[i] = tolower((unsigned char)h->lh_name[i]);
|
||||||
else
|
else
|
||||||
buf[i] = h->name[i];
|
buf[i] = h->lh_name[i];
|
||||||
}
|
}
|
||||||
buf[size] = '\0';
|
buf[size] = '\0';
|
||||||
return buf;
|
return buf;
|
||||||
@ -791,7 +801,7 @@ DEFUN (debug_ospf6_lsa_type,
|
|||||||
strlen(argv[idx_lsa]->arg))
|
strlen(argv[idx_lsa]->arg))
|
||||||
== 0)
|
== 0)
|
||||||
break;
|
break;
|
||||||
if (!strcasecmp(argv[idx_lsa]->arg, handler->name))
|
if (!strcasecmp(argv[idx_lsa]->arg, handler->lh_name))
|
||||||
break;
|
break;
|
||||||
handler = NULL;
|
handler = NULL;
|
||||||
}
|
}
|
||||||
@ -844,7 +854,7 @@ DEFUN (no_debug_ospf6_lsa_type,
|
|||||||
strlen(argv[idx_lsa]->arg))
|
strlen(argv[idx_lsa]->arg))
|
||||||
== 0)
|
== 0)
|
||||||
break;
|
break;
|
||||||
if (!strcasecmp(argv[idx_lsa]->arg, handler->name))
|
if (!strcasecmp(argv[idx_lsa]->arg, handler->lh_name))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -875,7 +885,7 @@ void install_element_ospf6_debug_lsa(void)
|
|||||||
int config_write_ospf6_debug_lsa(struct vty *vty)
|
int config_write_ospf6_debug_lsa(struct vty *vty)
|
||||||
{
|
{
|
||||||
u_int i;
|
u_int i;
|
||||||
struct ospf6_lsa_handler *handler;
|
const struct ospf6_lsa_handler *handler;
|
||||||
|
|
||||||
for (i = 0; i < vector_active(ospf6_lsa_handler_vector); i++) {
|
for (i = 0; i < vector_active(ospf6_lsa_handler_vector); i++) {
|
||||||
handler = vector_slot(ospf6_lsa_handler_vector, i);
|
handler = vector_slot(ospf6_lsa_handler_vector, i);
|
||||||
|
@ -137,18 +137,25 @@ struct ospf6_lsa {
|
|||||||
#define OSPF6_LSA_SEQWRAPPED 0x20
|
#define OSPF6_LSA_SEQWRAPPED 0x20
|
||||||
|
|
||||||
struct ospf6_lsa_handler {
|
struct ospf6_lsa_handler {
|
||||||
|
const struct {
|
||||||
u_int16_t type; /* host byte order */
|
u_int16_t type; /* host byte order */
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *short_name;
|
const char *short_name;
|
||||||
int (*show)(struct vty *, struct ospf6_lsa *);
|
int (*show)(struct vty *, struct ospf6_lsa *);
|
||||||
char *(*get_prefix_str)(struct ospf6_lsa *, char *buf, int buflen,
|
char *(*get_prefix_str)(struct ospf6_lsa *, char *buf, int buflen,
|
||||||
int pos);
|
int pos);
|
||||||
|
} s;
|
||||||
|
#define lh_type s.type
|
||||||
|
#define lh_name s.name
|
||||||
|
#define lh_short_name s.short_name
|
||||||
|
#define lh_show s.show
|
||||||
|
#define lh_get_prefix_str s.get_prefix_str
|
||||||
u_char debug;
|
u_char debug;
|
||||||
|
#define lh_debug debug
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct ospf6_lsa_handler unknown_handler;
|
#define OSPF6_LSA_IS_KNOWN(t) \
|
||||||
#define OSPF6_LSA_IS_KNOWN(type) \
|
(ospf6_get_lsa_handler(t).lh_type != OSPF6_LSTYPE_UNKNOWN ? 1 : 0)
|
||||||
(ospf6_get_lsa_handler(type) != &unknown_handler ? 1 : 0)
|
|
||||||
|
|
||||||
extern vector ospf6_lsa_handler_vector;
|
extern vector ospf6_lsa_handler_vector;
|
||||||
|
|
||||||
@ -237,8 +244,8 @@ extern int ospf6_lsa_checksum_valid(struct ospf6_lsa_header *);
|
|||||||
extern int ospf6_lsa_prohibited_duration(u_int16_t type, u_int32_t id,
|
extern int ospf6_lsa_prohibited_duration(u_int16_t type, u_int32_t id,
|
||||||
u_int32_t adv_router, void *scope);
|
u_int32_t adv_router, void *scope);
|
||||||
|
|
||||||
extern void ospf6_install_lsa_handler(struct ospf6_lsa_handler *handler);
|
extern void ospf6_install_lsa_handler(const struct ospf6_lsa_handler *handler);
|
||||||
extern struct ospf6_lsa_handler *ospf6_get_lsa_handler(u_int16_t type);
|
extern const struct ospf6_lsa_handler *ospf6_get_lsa_handler(u_int16_t type);
|
||||||
|
|
||||||
extern void ospf6_lsa_init(void);
|
extern void ospf6_lsa_init(void);
|
||||||
extern void ospf6_lsa_terminate(void);
|
extern void ospf6_lsa_terminate(void);
|
||||||
|
@ -2322,7 +2322,7 @@ void ospf_apiserver_clients_notify_nsm_change(struct ospf_neighbor *nbr)
|
|||||||
{
|
{
|
||||||
struct msg *msg;
|
struct msg *msg;
|
||||||
struct in_addr ifaddr = {.s_addr = 0L};
|
struct in_addr ifaddr = {.s_addr = 0L};
|
||||||
struct in_addr nbraddr = {.s_addr = 0L};
|
struct in_addr nbraddr;
|
||||||
|
|
||||||
assert(nbr);
|
assert(nbr);
|
||||||
|
|
||||||
|
@ -169,6 +169,7 @@ const char *ospf_timeval_dump(struct timeval *t, char *buf, size_t size)
|
|||||||
if (us >= 1000) {
|
if (us >= 1000) {
|
||||||
ms = us / 1000;
|
ms = us / 1000;
|
||||||
us %= 1000;
|
us %= 1000;
|
||||||
|
(void)us; /* unused */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ms >= 1000) {
|
if (ms >= 1000) {
|
||||||
|
@ -2010,7 +2010,7 @@ DEFUN (show_ipv6_ripng,
|
|||||||
|
|
||||||
len = 28 - len;
|
len = 28 - len;
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
len = vty_out(vty, "%*s", len, " ");
|
vty_out(vty, "%*s", len, " ");
|
||||||
|
|
||||||
/* from */
|
/* from */
|
||||||
if ((rinfo->type == ZEBRA_ROUTE_RIPNG)
|
if ((rinfo->type == ZEBRA_ROUTE_RIPNG)
|
||||||
|
@ -451,7 +451,7 @@ int main(int argc, char **argv, char **env)
|
|||||||
exit(ret);
|
exit(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dryrun && cmd) {
|
if (dryrun && cmd && cmd->line) {
|
||||||
vtysh_execute("enable");
|
vtysh_execute("enable");
|
||||||
while (cmd) {
|
while (cmd) {
|
||||||
struct cmd_rec *cr;
|
struct cmd_rec *cr;
|
||||||
@ -552,7 +552,7 @@ int main(int argc, char **argv, char **env)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If eval mode. */
|
/* If eval mode. */
|
||||||
if (cmd) {
|
if (cmd && cmd->line) {
|
||||||
/* Enter into enable node. */
|
/* Enter into enable node. */
|
||||||
vtysh_execute("enable");
|
vtysh_execute("enable");
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ static int netlink_route_change_read_unicast(struct sockaddr_nl *snl,
|
|||||||
struct rtattr *tb[RTA_MAX + 1];
|
struct rtattr *tb[RTA_MAX + 1];
|
||||||
u_char flags = 0;
|
u_char flags = 0;
|
||||||
struct prefix p;
|
struct prefix p;
|
||||||
struct prefix_ipv6 src_p;
|
struct prefix_ipv6 src_p = {};
|
||||||
vrf_id_t vrf_id = VRF_DEFAULT;
|
vrf_id_t vrf_id = VRF_DEFAULT;
|
||||||
|
|
||||||
char anyaddr[16] = {0};
|
char anyaddr[16] = {0};
|
||||||
|
Loading…
Reference in New Issue
Block a user