Skip to content

Commit ded59bc

Browse files
authored
Merge pull request FRRouting#17013 from dksharp5/removal_functions
Removal functions
2 parents 86a2c82 + f62dfc5 commit ded59bc

8 files changed

+0
-284
lines changed

lib/log.c

-1
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,6 @@ static const struct zebra_desc_table command_types[] = {
351351
DESC_ENTRY(ZEBRA_BFD_DEST_REPLAY),
352352
DESC_ENTRY(ZEBRA_REDISTRIBUTE_ROUTE_ADD),
353353
DESC_ENTRY(ZEBRA_REDISTRIBUTE_ROUTE_DEL),
354-
DESC_ENTRY(ZEBRA_VRF_UNREGISTER),
355354
DESC_ENTRY(ZEBRA_VRF_ADD),
356355
DESC_ENTRY(ZEBRA_VRF_DELETE),
357356
DESC_ENTRY(ZEBRA_VRF_LABEL),

lib/zclient.h

-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ typedef enum {
124124
ZEBRA_BFD_DEST_REPLAY,
125125
ZEBRA_REDISTRIBUTE_ROUTE_ADD,
126126
ZEBRA_REDISTRIBUTE_ROUTE_DEL,
127-
ZEBRA_VRF_UNREGISTER,
128127
ZEBRA_VRF_ADD,
129128
ZEBRA_VRF_DELETE,
130129
ZEBRA_VRF_LABEL,

zebra/if_netlink.c

-206
Original file line numberDiff line numberDiff line change
@@ -1032,212 +1032,6 @@ netlink_put_intf_update_msg(struct nl_batch *bth, struct zebra_dplane_ctx *ctx)
10321032
return netlink_batch_add_msg(bth, ctx, netlink_intf_msg_encoder, false);
10331033
}
10341034

1035-
int netlink_interface_addr(struct nlmsghdr *h, ns_id_t ns_id, int startup)
1036-
{
1037-
int len;
1038-
struct ifaddrmsg *ifa;
1039-
struct rtattr *tb[IFA_MAX + 1];
1040-
struct interface *ifp;
1041-
void *addr;
1042-
void *broad;
1043-
uint8_t flags = 0;
1044-
char *label = NULL;
1045-
struct zebra_ns *zns;
1046-
uint32_t metric = METRIC_MAX;
1047-
uint32_t kernel_flags = 0;
1048-
1049-
frrtrace(3, frr_zebra, netlink_interface_addr, h, ns_id, startup);
1050-
1051-
zns = zebra_ns_lookup(ns_id);
1052-
ifa = NLMSG_DATA(h);
1053-
1054-
if (ifa->ifa_family != AF_INET && ifa->ifa_family != AF_INET6) {
1055-
flog_warn(
1056-
EC_ZEBRA_UNKNOWN_FAMILY,
1057-
"Invalid address family: %u received from kernel interface addr change: %s",
1058-
ifa->ifa_family, nl_msg_type_to_str(h->nlmsg_type));
1059-
return 0;
1060-
}
1061-
1062-
if (h->nlmsg_type != RTM_NEWADDR && h->nlmsg_type != RTM_DELADDR)
1063-
return 0;
1064-
1065-
len = h->nlmsg_len - NLMSG_LENGTH(sizeof(struct ifaddrmsg));
1066-
if (len < 0) {
1067-
zlog_err(
1068-
"%s: Message received from netlink is of a broken size: %d %zu",
1069-
__func__, h->nlmsg_len,
1070-
(size_t)NLMSG_LENGTH(sizeof(struct ifaddrmsg)));
1071-
return -1;
1072-
}
1073-
1074-
netlink_parse_rtattr(tb, IFA_MAX, IFA_RTA(ifa), len);
1075-
1076-
ifp = if_lookup_by_index_per_ns(zns, ifa->ifa_index);
1077-
if (ifp == NULL) {
1078-
if (startup) {
1079-
/* During startup, failure to lookup the referenced
1080-
* interface should not be an error, so we have
1081-
* downgraded this condition to warning, and we permit
1082-
* the startup interface state retrieval to continue.
1083-
*/
1084-
flog_warn(EC_LIB_INTERFACE,
1085-
"%s: can't find interface by index %d",
1086-
__func__, ifa->ifa_index);
1087-
return 0;
1088-
} else {
1089-
flog_err(EC_LIB_INTERFACE,
1090-
"%s: can't find interface by index %d",
1091-
__func__, ifa->ifa_index);
1092-
return -1;
1093-
}
1094-
}
1095-
1096-
/* Flags passed through */
1097-
if (tb[IFA_FLAGS])
1098-
kernel_flags = *(int *)RTA_DATA(tb[IFA_FLAGS]);
1099-
else
1100-
kernel_flags = ifa->ifa_flags;
1101-
1102-
if (IS_ZEBRA_DEBUG_KERNEL) /* remove this line to see initial ifcfg */
1103-
{
1104-
char buf[BUFSIZ];
1105-
zlog_debug("%s %s %s flags 0x%x:", __func__,
1106-
nl_msg_type_to_str(h->nlmsg_type), ifp->name,
1107-
kernel_flags);
1108-
if (tb[IFA_LOCAL])
1109-
zlog_debug(" IFA_LOCAL %s/%d",
1110-
inet_ntop(ifa->ifa_family,
1111-
RTA_DATA(tb[IFA_LOCAL]), buf,
1112-
BUFSIZ),
1113-
ifa->ifa_prefixlen);
1114-
if (tb[IFA_ADDRESS])
1115-
zlog_debug(" IFA_ADDRESS %s/%d",
1116-
inet_ntop(ifa->ifa_family,
1117-
RTA_DATA(tb[IFA_ADDRESS]), buf,
1118-
BUFSIZ),
1119-
ifa->ifa_prefixlen);
1120-
if (tb[IFA_BROADCAST])
1121-
zlog_debug(" IFA_BROADCAST %s/%d",
1122-
inet_ntop(ifa->ifa_family,
1123-
RTA_DATA(tb[IFA_BROADCAST]), buf,
1124-
BUFSIZ),
1125-
ifa->ifa_prefixlen);
1126-
if (tb[IFA_LABEL] && strcmp(ifp->name, RTA_DATA(tb[IFA_LABEL])))
1127-
zlog_debug(" IFA_LABEL %s",
1128-
(char *)RTA_DATA(tb[IFA_LABEL]));
1129-
1130-
if (tb[IFA_CACHEINFO]) {
1131-
struct ifa_cacheinfo *ci = RTA_DATA(tb[IFA_CACHEINFO]);
1132-
zlog_debug(" IFA_CACHEINFO pref %d, valid %d",
1133-
ci->ifa_prefered, ci->ifa_valid);
1134-
}
1135-
}
1136-
1137-
/* logic copied from iproute2/ip/ipaddress.c:print_addrinfo() */
1138-
if (tb[IFA_LOCAL] == NULL)
1139-
tb[IFA_LOCAL] = tb[IFA_ADDRESS];
1140-
if (tb[IFA_ADDRESS] == NULL)
1141-
tb[IFA_ADDRESS] = tb[IFA_LOCAL];
1142-
1143-
/* local interface address */
1144-
addr = (tb[IFA_LOCAL] ? RTA_DATA(tb[IFA_LOCAL]) : NULL);
1145-
1146-
/* is there a peer address? */
1147-
if (tb[IFA_ADDRESS]
1148-
&& memcmp(RTA_DATA(tb[IFA_ADDRESS]), RTA_DATA(tb[IFA_LOCAL]),
1149-
RTA_PAYLOAD(tb[IFA_ADDRESS]))) {
1150-
broad = RTA_DATA(tb[IFA_ADDRESS]);
1151-
SET_FLAG(flags, ZEBRA_IFA_PEER);
1152-
} else
1153-
/* seeking a broadcast address */
1154-
broad = (tb[IFA_BROADCAST] ? RTA_DATA(tb[IFA_BROADCAST])
1155-
: NULL);
1156-
1157-
/* addr is primary key, SOL if we don't have one */
1158-
if (addr == NULL) {
1159-
zlog_debug("%s: Local Interface Address is NULL for %s",
1160-
__func__, ifp->name);
1161-
return -1;
1162-
}
1163-
1164-
/* Flags. */
1165-
if (kernel_flags & IFA_F_SECONDARY)
1166-
SET_FLAG(flags, ZEBRA_IFA_SECONDARY);
1167-
1168-
/* Label */
1169-
if (tb[IFA_LABEL])
1170-
label = (char *)RTA_DATA(tb[IFA_LABEL]);
1171-
1172-
if (label && strcmp(ifp->name, label) == 0)
1173-
label = NULL;
1174-
1175-
if (tb[IFA_RT_PRIORITY])
1176-
metric = *(uint32_t *)RTA_DATA(tb[IFA_RT_PRIORITY]);
1177-
1178-
/* Register interface address to the interface. */
1179-
if (ifa->ifa_family == AF_INET) {
1180-
if (ifa->ifa_prefixlen > IPV4_MAX_BITLEN) {
1181-
zlog_err(
1182-
"Invalid prefix length: %u received from kernel interface addr change: %s",
1183-
ifa->ifa_prefixlen,
1184-
nl_msg_type_to_str(h->nlmsg_type));
1185-
return -1;
1186-
}
1187-
1188-
if (h->nlmsg_type == RTM_NEWADDR)
1189-
connected_add_ipv4(ifp, flags, (struct in_addr *)addr,
1190-
ifa->ifa_prefixlen,
1191-
(struct in_addr *)broad, label,
1192-
metric);
1193-
else if (CHECK_FLAG(flags, ZEBRA_IFA_PEER)) {
1194-
/* Delete with a peer address */
1195-
connected_delete_ipv4(
1196-
ifp, flags, (struct in_addr *)addr,
1197-
ifa->ifa_prefixlen, broad);
1198-
} else
1199-
connected_delete_ipv4(
1200-
ifp, flags, (struct in_addr *)addr,
1201-
ifa->ifa_prefixlen, NULL);
1202-
}
1203-
1204-
if (ifa->ifa_family == AF_INET6) {
1205-
if (ifa->ifa_prefixlen > IPV6_MAX_BITLEN) {
1206-
zlog_err(
1207-
"Invalid prefix length: %u received from kernel interface addr change: %s",
1208-
ifa->ifa_prefixlen,
1209-
nl_msg_type_to_str(h->nlmsg_type));
1210-
return -1;
1211-
}
1212-
if (h->nlmsg_type == RTM_NEWADDR) {
1213-
/* Only consider valid addresses; we'll not get a
1214-
* notification from
1215-
* the kernel till IPv6 DAD has completed, but at init
1216-
* time, Quagga
1217-
* does query for and will receive all addresses.
1218-
*/
1219-
if (!(kernel_flags
1220-
& (IFA_F_DADFAILED | IFA_F_TENTATIVE)))
1221-
connected_add_ipv6(ifp, flags,
1222-
(struct in6_addr *)addr,
1223-
(struct in6_addr *)broad,
1224-
ifa->ifa_prefixlen, label,
1225-
metric);
1226-
} else
1227-
connected_delete_ipv6(ifp, (struct in6_addr *)addr,
1228-
NULL, ifa->ifa_prefixlen);
1229-
}
1230-
1231-
/*
1232-
* Linux kernel does not send route delete on interface down/addr del
1233-
* so we have to re-process routes it owns (i.e. kernel routes)
1234-
*/
1235-
if (h->nlmsg_type != RTM_NEWADDR)
1236-
rib_update(RIB_UPDATE_KERNEL);
1237-
1238-
return 0;
1239-
}
1240-
12411035
/*
12421036
* Parse and validate an incoming interface address change message,
12431037
* generating a dplane context object.

zebra/if_netlink.h

-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
extern "C" {
1313
#endif
1414

15-
extern int netlink_interface_addr(struct nlmsghdr *h, ns_id_t ns_id,
16-
int startup);
17-
1815
/*
1916
* Parse an incoming interface address change message, generate a dplane
2017
* context object for processing.

zebra/tc_netlink.c

-40
Original file line numberDiff line numberDiff line change
@@ -660,27 +660,6 @@ netlink_put_tc_filter_update_msg(struct nl_batch *bth,
660660
return ret;
661661
}
662662

663-
/*
664-
* Request filters from the kernel
665-
*/
666-
static int netlink_request_filters(struct zebra_ns *zns, int family, int type,
667-
ifindex_t ifindex)
668-
{
669-
struct {
670-
struct nlmsghdr n;
671-
struct tcmsg tc;
672-
} req;
673-
674-
memset(&req, 0, sizeof(req));
675-
req.n.nlmsg_type = type;
676-
req.n.nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST;
677-
req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg));
678-
req.tc.tcm_family = family;
679-
req.tc.tcm_ifindex = ifindex;
680-
681-
return netlink_request(&zns->netlink_cmd, &req);
682-
}
683-
684663
/*
685664
* Request queue discipline from the kernel
686665
*/
@@ -852,23 +831,4 @@ int netlink_qdisc_read(struct zebra_ns *zns)
852831
return 0;
853832
}
854833

855-
int netlink_tfilter_read_for_interface(struct zebra_ns *zns, ifindex_t ifindex)
856-
{
857-
int ret;
858-
struct zebra_dplane_info dp_info;
859-
860-
zebra_dplane_info_from_zns(&dp_info, zns, true);
861-
862-
ret = netlink_request_filters(zns, AF_UNSPEC, RTM_GETTFILTER, ifindex);
863-
if (ret < 0)
864-
return ret;
865-
866-
ret = netlink_parse_info(netlink_tfilter_change, &zns->netlink_cmd,
867-
&dp_info, 0, true);
868-
if (ret < 0)
869-
return ret;
870-
871-
return 0;
872-
}
873-
874834
#endif /* HAVE_NETLINK */

zebra/tc_netlink.h

-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ netlink_put_tc_filter_update_msg(struct nl_batch *bth,
5050
*/
5151

5252
extern int netlink_qdisc_read(struct zebra_ns *zns);
53-
extern int netlink_tfilter_read_for_interface(struct zebra_ns *zns,
54-
ifindex_t ifindex);
5553

5654
extern int netlink_tfilter_change(struct nlmsghdr *h, ns_id_t ns_id,
5755
int startup);

zebra/zapi_msg.c

-17
Original file line numberDiff line numberDiff line change
@@ -2477,22 +2477,6 @@ static void zread_hello(ZAPI_HANDLER_ARGS)
24772477
return;
24782478
}
24792479

2480-
/* Unregister all information in a VRF. */
2481-
static void zread_vrf_unregister(ZAPI_HANDLER_ARGS)
2482-
{
2483-
int i;
2484-
afi_t afi;
2485-
2486-
for (afi = AFI_IP; afi < AFI_MAX; afi++) {
2487-
for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
2488-
vrf_bitmap_unset(&client->redist[afi][i],
2489-
zvrf_id(zvrf));
2490-
vrf_bitmap_unset(&client->redist_default[afi], zvrf_id(zvrf));
2491-
vrf_bitmap_unset(&client->ridinfo[afi], zvrf_id(zvrf));
2492-
vrf_bitmap_unset(&client->neighinfo[afi], zvrf_id(zvrf));
2493-
}
2494-
}
2495-
24962480
/*
24972481
* Validate incoming zapi mpls lsp / labels message
24982482
*/
@@ -4055,7 +4039,6 @@ void (*const zserv_handlers[])(ZAPI_HANDLER_ARGS) = {
40554039
#if HAVE_BFDD > 0
40564040
[ZEBRA_BFD_DEST_REPLAY] = zebra_ptm_bfd_dst_replay,
40574041
#endif /* HAVE_BFDD */
4058-
[ZEBRA_VRF_UNREGISTER] = zread_vrf_unregister,
40594042
[ZEBRA_VRF_LABEL] = zread_vrf_label,
40604043
[ZEBRA_BFD_CLIENT_REGISTER] = zebra_ptm_bfd_client_register,
40614044
[ZEBRA_INTERFACE_ENABLE_RADV] = zebra_interface_radv_enable,

zebra/zebra_trace.h

-14
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,6 @@ TRACEPOINT_EVENT(
6868
)
6969
)
7070

71-
TRACEPOINT_EVENT(
72-
frr_zebra,
73-
netlink_interface_addr,
74-
TP_ARGS(
75-
struct nlmsghdr *, header,
76-
ns_id_t, ns_id,
77-
int, startup),
78-
TP_FIELDS(
79-
ctf_integer_hex(intptr_t, header, header)
80-
ctf_integer(uint32_t, ns_id, ns_id)
81-
ctf_integer(uint32_t, startup, startup)
82-
)
83-
)
84-
8571
TRACEPOINT_EVENT(
8672
frr_zebra,
8773
netlink_route_change_read_unicast,

0 commit comments

Comments
 (0)