summaryrefslogtreecommitdiffstats
path: root/ldpd
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:24:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:24:34 +0000
commit137ce8dd46d313f15ee93ddbb5428d702aa61ed8 (patch)
treea49f76849019651842962dff2197b705e33831e7 /ldpd
parentReleasing progress-linux version 9.1-0.1~progress7.99u1. (diff)
downloadfrr-137ce8dd46d313f15ee93ddbb5428d702aa61ed8.tar.xz
frr-137ce8dd46d313f15ee93ddbb5428d702aa61ed8.zip
Merging upstream version 10.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--ldpd/control.c1
-rw-r--r--ldpd/init.c6
-rw-r--r--ldpd/lde.c6
-rw-r--r--ldpd/ldp.h6
-rw-r--r--ldpd/ldp_vty_exec.c2
-rw-r--r--ldpd/ldp_zebra.c13
-rw-r--r--ldpd/ldpd.c33
-rw-r--r--ldpd/ldpd.h22
-rw-r--r--ldpd/neighbor.c15
-rw-r--r--ldpd/socket.c1
10 files changed, 45 insertions, 60 deletions
diff --git a/ldpd/control.c b/ldpd/control.c
index db52d46..a08ce4c 100644
--- a/ldpd/control.c
+++ b/ldpd/control.c
@@ -6,6 +6,7 @@
*/
#include <zebra.h>
+#include <sys/stat.h>
#include <sys/un.h>
#include "ldpd.h"
diff --git a/ldpd/init.c b/ldpd/init.c
index f0cb98e..ef78247 100644
--- a/ldpd/init.c
+++ b/ldpd/init.c
@@ -229,9 +229,11 @@ send_capability(struct nbr *nbr, uint16_t capability, int enable)
* Announcement Parameter in Capability messages sent to
* its peers".
*/
- /* FALLTHROUGH */
+ fatalx("send_capability: An LDP speaker MUST NOT include the Dynamic Capability Announcement Parameter");
+ break;
default:
fatalx("send_capability: unsupported capability");
+ break;
}
if (err) {
@@ -333,7 +335,7 @@ recv_capability(struct nbr *nbr, char *buf, uint16_t len)
* parameter and process any other Capability Parameters
* in the message".
*/
- /* FALLTHROUGH */
+ fallthrough;
default:
if (!CHECK_FLAG(ntohs(tlv.type), UNKNOWN_FLAG))
send_notification_rtlvs(nbr, S_UNSSUPORTDCAP,
diff --git a/ldpd/lde.c b/ldpd/lde.c
index c7e915d..ef4aeca 100644
--- a/ldpd/lde.c
+++ b/ldpd/lde.c
@@ -2135,12 +2135,8 @@ static void zclient_sync_retry(struct event *thread)
*/
static void zclient_sync_init(void)
{
- struct zclient_options options = zclient_options_default;
-
- options.synchronous = true;
-
/* Initialize special zclient for synchronous message exchanges. */
- zclient_sync = zclient_new(master, &options, NULL, 0);
+ zclient_sync = zclient_new(master, &zclient_options_sync, NULL, 0);
zclient_sync->sock = -1;
zclient_sync->redist_default = ZEBRA_ROUTE_LDP;
zclient_sync->session_id = 1; /* Distinguish from main session */
diff --git a/ldpd/ldp.h b/ldpd/ldp.h
index 33cf93c..1f0fdb5 100644
--- a/ldpd/ldp.h
+++ b/ldpd/ldp.h
@@ -12,6 +12,12 @@
#ifndef _LDP_H_
#define _LDP_H_
+/* this does not include "%s/", frr_runstatedir because the command-line
+ * override option specifies a *directory* rather than a full file name.
+ * Therefore the final part is needed on its own.
+ */
+#define LDPD_SOCK_NAME "ldpd.sock"
+
/* misc */
#define LDP_VERSION 1
#define LDP_PORT 646
diff --git a/ldpd/ldp_vty_exec.c b/ldpd/ldp_vty_exec.c
index 906b5c1..f3bcd1b 100644
--- a/ldpd/ldp_vty_exec.c
+++ b/ldpd/ldp_vty_exec.c
@@ -1106,7 +1106,7 @@ show_lib_msg(struct vty *vty, struct imsg *imsg, struct show_params *params)
if (params->lib.remote_label != NO_LABEL &&
params->lib.remote_label != rt->remote_label)
return (0);
- /* FALLTHROUGH */
+ fallthrough;
case IMSG_CTL_SHOW_LIB_RCVD:
rt = imsg->data;
diff --git a/ldpd/ldp_zebra.c b/ldpd/ldp_zebra.c
index 0fd5d46..df682a1 100644
--- a/ldpd/ldp_zebra.c
+++ b/ldpd/ldp_zebra.c
@@ -330,7 +330,6 @@ void
kif_redistribute(const char *ifname)
{
struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
- struct listnode *cnode;
struct interface *ifp;
struct connected *ifc;
struct kif kif;
@@ -343,7 +342,7 @@ kif_redistribute(const char *ifname)
ifp2kif(ifp, &kif);
main_imsg_compose_both(IMSG_IFSTATUS, &kif, sizeof(kif));
- for (ALL_LIST_ELEMENTS_RO(ifp->connected, cnode, ifc)) {
+ frr_each (if_connected, ifp->connected, ifc) {
ifc2kaddr(ifp, ifc, &ka);
main_imsg_compose_ldpe(IMSG_NEWADDR, 0, &ka, sizeof(ka));
}
@@ -400,7 +399,6 @@ ldp_ifp_destroy(struct interface *ifp)
static int
ldp_interface_status_change(struct interface *ifp)
{
- struct listnode *node;
struct connected *ifc;
struct kif kif;
struct kaddr ka;
@@ -411,12 +409,12 @@ ldp_interface_status_change(struct interface *ifp)
main_imsg_compose_both(IMSG_IFSTATUS, &kif, sizeof(kif));
if (if_is_operative(ifp)) {
- for (ALL_LIST_ELEMENTS_RO(ifp->connected, node, ifc)) {
+ frr_each (if_connected, ifp->connected, ifc) {
ifc2kaddr(ifp, ifc, &ka);
main_imsg_compose_ldpe(IMSG_NEWADDR, 0, &ka, sizeof(ka));
}
} else {
- for (ALL_LIST_ELEMENTS_RO(ifp->connected, node, ifc)) {
+ frr_each (if_connected, ifp->connected, ifc) {
ifc2kaddr(ifp, ifc, &ka);
main_imsg_compose_ldpe(IMSG_DELADDR, 0, &ka, sizeof(ka));
}
@@ -682,7 +680,10 @@ static zclient_handler *const ldp_handlers[] = {
void ldp_zebra_init(struct event_loop *master)
{
- if_zapi_callbacks(ldp_ifp_create, ldp_ifp_up, ldp_ifp_down, ldp_ifp_destroy);
+ hook_register_prio(if_real, 0, ldp_ifp_create);
+ hook_register_prio(if_up, 0, ldp_ifp_up);
+ hook_register_prio(if_down, 0, ldp_ifp_down);
+ hook_register_prio(if_unreal, 0, ldp_ifp_destroy);
/* Set default values. */
zclient = zclient_new(master, &zclient_options_default, ldp_handlers,
diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c
index 3c616d4..da29a4f 100644
--- a/ldpd/ldpd.c
+++ b/ldpd/ldpd.c
@@ -9,6 +9,9 @@
*/
#include <zebra.h>
+
+#include <signal.h>
+#include <fcntl.h>
#include <sys/wait.h>
#include "ldpd.h"
@@ -101,7 +104,6 @@ void ldp_agentx_enabled(void)
enum ldpd_process ldpd_process;
#define LDP_DEFAULT_CONFIG "ldpd.conf"
-#define LDP_VTY_PORT 2612
/* Master of threads. */
struct event_loop *master;
@@ -194,6 +196,7 @@ static const struct frr_yang_module_info *const ldpd_yang_modules[] = {
&frr_vrf_info,
};
+/* clang-format off */
FRR_DAEMON_INFO(ldpd, LDP,
.vty_port = LDP_VTY_PORT,
@@ -207,6 +210,7 @@ FRR_DAEMON_INFO(ldpd, LDP,
.yang_modules = ldpd_yang_modules,
.n_yang_modules = array_size(ldpd_yang_modules),
);
+/* clang-format on */
static void ldp_config_fork_apply(struct event *t)
{
@@ -229,12 +233,8 @@ main(int argc, char *argv[])
int lflag = 0, eflag = 0;
int pipe_parent2ldpe[2], pipe_parent2ldpe_sync[2];
int pipe_parent2lde[2], pipe_parent2lde_sync[2];
- char *ctl_sock_name;
bool ctl_sock_used = false;
- snprintf(ctl_sock_path, sizeof(ctl_sock_path), LDPD_SOCKET,
- "", "");
-
ldpd_process = PROC_MAIN;
log_procname = log_procnames[ldpd_process];
@@ -260,21 +260,8 @@ main(int argc, char *argv[])
break;
case OPTION_CTLSOCK:
ctl_sock_used = true;
- ctl_sock_name = strrchr(LDPD_SOCKET, '/');
- if (ctl_sock_name)
- /* skip '/' */
- ctl_sock_name++;
- else
- /*
- * LDPD_SOCKET configured as relative path
- * during config? Should really never happen for
- * sensible config
- */
- ctl_sock_name = (char *)LDPD_SOCKET;
- strlcpy(ctl_sock_path, optarg, sizeof(ctl_sock_path));
- strlcat(ctl_sock_path, "/", sizeof(ctl_sock_path));
- strlcat(ctl_sock_path, ctl_sock_name,
- sizeof(ctl_sock_path));
+ snprintf(ctl_sock_path, sizeof(ctl_sock_path),
+ "%s/" LDPD_SOCK_NAME, optarg);
break;
case 'n':
init.instance = atoi(optarg);
@@ -292,9 +279,9 @@ main(int argc, char *argv[])
}
}
- if (ldpd_di.pathspace && !ctl_sock_used)
- snprintf(ctl_sock_path, sizeof(ctl_sock_path), LDPD_SOCKET,
- "/", ldpd_di.pathspace);
+ if (!ctl_sock_used)
+ snprintf(ctl_sock_path, sizeof(ctl_sock_path),
+ "%s/" LDPD_SOCK_NAME, frr_runstatedir);
strlcpy(init.user, ldpd_privs.user, sizeof(init.user));
strlcpy(init.group, ldpd_privs.group, sizeof(init.group));
diff --git a/ldpd/ldpd.h b/ldpd/ldpd.h
index 1fec5be..81c6ba3 100644
--- a/ldpd/ldpd.h
+++ b/ldpd/ldpd.h
@@ -341,7 +341,7 @@ struct iface_ldp_sync {
struct iface {
RB_ENTRY(iface) entry;
- char name[INTERFACE_NAMSIZ];
+ char name[IFNAMSIZ];
ifindex_t ifindex;
struct if_addr_head addr_list;
struct in6_addr linklocal;
@@ -447,7 +447,7 @@ struct ldp_entity_stats {
struct l2vpn_if {
RB_ENTRY(l2vpn_if) entry;
struct l2vpn *l2vpn;
- char ifname[INTERFACE_NAMSIZ];
+ char ifname[IFNAMSIZ];
ifindex_t ifindex;
int operative;
uint8_t mac[ETH_ALEN];
@@ -464,7 +464,7 @@ struct l2vpn_pw {
int af;
union ldpd_addr addr;
uint32_t pwid;
- char ifname[INTERFACE_NAMSIZ];
+ char ifname[IFNAMSIZ];
ifindex_t ifindex;
bool enabled;
uint32_t remote_group;
@@ -496,7 +496,7 @@ struct l2vpn {
int type;
int pw_type;
int mtu;
- char br_ifname[INTERFACE_NAMSIZ];
+ char br_ifname[IFNAMSIZ];
ifindex_t br_ifindex;
struct l2vpn_if_head if_tree;
struct l2vpn_pw_head pw_tree;
@@ -618,7 +618,7 @@ struct kroute {
};
struct kaddr {
- char ifname[INTERFACE_NAMSIZ];
+ char ifname[IFNAMSIZ];
ifindex_t ifindex;
int af;
union ldpd_addr addr;
@@ -627,7 +627,7 @@ struct kaddr {
};
struct kif {
- char ifname[INTERFACE_NAMSIZ];
+ char ifname[IFNAMSIZ];
ifindex_t ifindex;
int flags;
int operative;
@@ -645,7 +645,7 @@ struct acl_check {
/* control data structures */
struct ctl_iface {
int af;
- char name[INTERFACE_NAMSIZ];
+ char name[IFNAMSIZ];
ifindex_t ifindex;
int state;
enum iface_type type;
@@ -656,7 +656,7 @@ struct ctl_iface {
};
struct ctl_disc_if {
- char name[INTERFACE_NAMSIZ];
+ char name[IFNAMSIZ];
int active_v4;
int active_v6;
int no_adj;
@@ -672,7 +672,7 @@ struct ctl_adj {
int af;
struct in_addr id;
enum hello_type type;
- char ifname[INTERFACE_NAMSIZ];
+ char ifname[IFNAMSIZ];
union ldpd_addr src_addr;
uint16_t holdtime;
uint16_t holdtime_remaining;
@@ -712,7 +712,7 @@ struct ctl_rt {
struct ctl_pw {
uint16_t type;
char l2vpn_name[L2VPN_NAME_LEN];
- char ifname[INTERFACE_NAMSIZ];
+ char ifname[IFNAMSIZ];
uint32_t pwid;
struct in_addr lsr_id;
uint32_t local_label;
@@ -728,7 +728,7 @@ struct ctl_pw {
};
struct ctl_ldp_sync {
- char name[INTERFACE_NAMSIZ];
+ char name[IFNAMSIZ];
ifindex_t ifindex;
bool in_sync;
bool timer_running;
diff --git a/ldpd/neighbor.c b/ldpd/neighbor.c
index 5209c55..d40728b 100644
--- a/ldpd/neighbor.c
+++ b/ldpd/neighbor.c
@@ -505,21 +505,12 @@ nbr_start_idtimer(struct nbr *nbr)
{
int secs;
- secs = INIT_DELAY_TMR;
- switch(nbr->idtimer_cnt) {
- default:
+ if (nbr->idtimer_cnt > 2) {
/* do not further increase the counter */
secs = MAX_DELAY_TMR;
- break;
- case 2:
- secs *= 2;
- /* FALLTHROUGH */
- case 1:
- secs *= 2;
- /* FALLTHROUGH */
- case 0:
+ } else {
+ secs = INIT_DELAY_TMR * (1 << nbr->idtimer_cnt);
nbr->idtimer_cnt++;
- break;
}
EVENT_OFF(nbr->initdelay_timer);
diff --git a/ldpd/socket.c b/ldpd/socket.c
index 6b7e475..71d5c21 100644
--- a/ldpd/socket.c
+++ b/ldpd/socket.c
@@ -9,6 +9,7 @@
*/
#include <zebra.h>
+#include <fcntl.h>
#include "ldpd.h"
#include "ldpe.h"