summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Stapp <mjs@labn.net>2024-02-01 11:40:02 -0500
committerMark Stapp <mjs@labn.net>2024-02-01 11:40:02 -0500
commit72b31b96fc3adc37d0f63e57344a229eef2d8c94 (patch)
tree9a61369ff90b1ac1a68ace750c5f60f3eb6fa259
parentcd869ebcf2ec13cf50071d2826d0aa1b309a30e9 (diff)
*: create a single registry of daemons' default port values
Create a single registry of default port values that daemons are using. Most of these are vty ports, but there are some others for features like ospfapi and zebra FPM. Signed-off-by: Mark Stapp <mjs@labn.net>
-rw-r--r--babeld/babeld.h1
-rw-r--r--bfdd/bfdd.c2
-rw-r--r--bgpd/bgpd.h1
-rw-r--r--eigrpd/eigrp_const.h3
-rw-r--r--fpm/fpm.h5
-rw-r--r--isisd/isis_main.c3
-rw-r--r--ldpd/ldpd.c1
-rw-r--r--lib/libfrr.c2
-rw-r--r--lib/libfrr.h43
-rw-r--r--lib/zebra.h3
-rw-r--r--mgmtd/mgmt.h1
-rw-r--r--nhrpd/nhrpd.h1
-rw-r--r--ospf6d/ospf6_main.c3
-rw-r--r--ospfd/ospf_api.h4
-rw-r--r--ospfd/ospfd.h3
-rw-r--r--pathd/path_main.c2
-rw-r--r--pbrd/pbr_main.c2
-rw-r--r--pimd/pimd.h3
-rw-r--r--ripd/ripd.h1
-rw-r--r--ripngd/ripngd.h1
-rw-r--r--sharpd/sharp_main.c2
-rw-r--r--staticd/static_main.c2
-rw-r--r--vrrpd/vrrp_main.c2
-rw-r--r--zebra/dplane_fpm_nl.c9
-rw-r--r--zebra/zserv.h3
25 files changed, 49 insertions, 54 deletions
diff --git a/babeld/babeld.h b/babeld/babeld.h
index 619550f651..5573719ab3 100644
--- a/babeld/babeld.h
+++ b/babeld/babeld.h
@@ -53,7 +53,6 @@ Copyright 2011 by Matthieu Boutier and Juliusz Chroboczek
#endif
-#define BABEL_VTY_PORT 2609
#define BABEL_DEFAULT_CONFIG "babeld.conf"
/* Values in milliseconds */
diff --git a/bfdd/bfdd.c b/bfdd/bfdd.c
index 1a89b9b351..243cf5c129 100644
--- a/bfdd/bfdd.c
+++ b/bfdd/bfdd.c
@@ -119,7 +119,7 @@ static const struct frr_yang_module_info *const bfdd_yang_modules[] = {
/* clang-format off */
FRR_DAEMON_INFO(bfdd, BFD,
- .vty_port = 2617,
+ .vty_port = BFDD_VTY_PORT,
.proghelp = "Implementation of the BFD protocol.",
.signals = bfd_signals,
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index a1593421be..d4dd67b850 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -2064,7 +2064,6 @@ struct bgp_nlri {
#define BGP_UPTIME_LEN 25
/* Default configuration settings for bgpd. */
-#define BGP_VTY_PORT 2605
#define BGP_DEFAULT_CONFIG "bgpd.conf"
/* BGP Dynamic Neighbors feature */
diff --git a/eigrpd/eigrp_const.h b/eigrpd/eigrp_const.h
index 607719d4f1..05fbae32af 100644
--- a/eigrpd/eigrp_const.h
+++ b/eigrpd/eigrp_const.h
@@ -61,9 +61,6 @@
/* IP TTL for EIGRP protocol. */
#define EIGRP_IP_TTL 1
-/* VTY port number. */
-#define EIGRP_VTY_PORT 2613
-
/* Default configuration file name for eigrp. */
#define EIGRP_DEFAULT_CONFIG "eigrpd.conf"
diff --git a/fpm/fpm.h b/fpm/fpm.h
index b08310f675..70c0df5715 100644
--- a/fpm/fpm.h
+++ b/fpm/fpm.h
@@ -63,11 +63,6 @@
#define FPM_DEFAULT_IP (htonl (INADDR_LOOPBACK))
/*
- * default port for fpm connections
- */
-#define FPM_DEFAULT_PORT 2620
-
-/*
* Largest message that can be sent to or received from the FPM.
*/
#define FPM_MAX_MSG_LEN 4096
diff --git a/isisd/isis_main.c b/isisd/isis_main.c
index 47e5f6dc93..60ec8cdad4 100644
--- a/isisd/isis_main.c
+++ b/isisd/isis_main.c
@@ -51,9 +51,6 @@
/* Default configuration file name */
#define ISISD_DEFAULT_CONFIG "isisd.conf"
-/* Default vty port */
-#define ISISD_VTY_PORT 2608
-#define FABRICD_VTY_PORT 2618
#define FABRICD_STATE_NAME "%s/fabricd.json", frr_libstatedir
#define ISISD_STATE_NAME "%s/isisd.json", frr_libstatedir
diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c
index 0d66fc70e7..da29a4f20d 100644
--- a/ldpd/ldpd.c
+++ b/ldpd/ldpd.c
@@ -104,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;
diff --git a/lib/libfrr.c b/lib/libfrr.c
index d904f6f8bb..9e472054dd 100644
--- a/lib/libfrr.c
+++ b/lib/libfrr.c
@@ -208,7 +208,7 @@ bool frr_zclient_addr(struct sockaddr_storage *sa, socklen_t *sa_len,
if (!strncmp(path, ZAPI_TCP_PATHNAME, strlen(ZAPI_TCP_PATHNAME))) {
/* note: this functionality is disabled at bottom */
int af;
- int port = ZEBRA_PORT;
+ int port = ZEBRA_TCP_PORT;
char *err = NULL;
struct sockaddr_in *sin = NULL;
struct sockaddr_in6 *sin6 = NULL;
diff --git a/lib/libfrr.h b/lib/libfrr.h
index 27b877da18..ee436d9f8f 100644
--- a/lib/libfrr.h
+++ b/lib/libfrr.h
@@ -55,6 +55,49 @@ struct log_arg {
};
DECLARE_DLIST(log_args, struct log_arg, itm);
+/* Registry of daemons' port defaults. Many of these are VTY ports; some
+ * daemons have default ports for other features such as ospfapi, or zebra's
+ * FPM.
+ */
+
+/* default zebra TCP port for zapi; this is currently disabled for security
+ * reasons.
+ */
+#define ZEBRA_TCP_PORT 2600
+
+#define ZEBRA_VTY_PORT 2601
+#define RIP_VTY_PORT 2602
+#define RIPNG_VTY_PORT 2603
+#define OSPF_VTY_PORT 2604
+#define BGP_VTY_PORT 2605
+#define OSPF6_VTY_PORT 2606
+
+/* Default API server port to accept connection request from client-side.
+ * This value could be overridden by "ospfapi" entry in "/etc/services".
+ */
+#define OSPF_API_SYNC_PORT 2607
+
+#define ISISD_VTY_PORT 2608
+#define BABEL_VTY_PORT 2609
+#define NHRP_VTY_PORT 2610
+#define PIMD_VTY_PORT 2611
+#define LDP_VTY_PORT 2612
+#define EIGRP_VTY_PORT 2613
+#define SHARP_VTY_PORT 2614
+#define PBR_VTY_PORT 2615
+#define STATIC_VTY_PORT 2616
+#define BFDD_VTY_PORT 2617
+#define FABRICD_VTY_PORT 2618
+#define VRRP_VTY_PORT 2619
+
+/* default port for FPM connections */
+#define FPM_DEFAULT_PORT 2620
+
+#define PATH_VTY_PORT 2621
+#define PIM6D_VTY_PORT 2622
+#define MGMTD_VTY_PORT 2623
+/* Registry of daemons' port defaults */
+
enum frr_cli_mode {
FRR_CLI_CLASSIC = 0,
FRR_CLI_TRANSACTIONAL,
diff --git a/lib/zebra.h b/lib/zebra.h
index 8b0800c257..15a54f6cdf 100644
--- a/lib/zebra.h
+++ b/lib/zebra.h
@@ -221,9 +221,6 @@ struct in_pktinfo {
#define IN6_ARE_ADDR_EQUAL IN6_IS_ADDR_EQUAL
#endif /* IN6_ARE_ADDR_EQUAL */
-/* default zebra TCP port for zclient */
-#define ZEBRA_PORT 2600
-
/* Zebra route's types are defined in route_types.h */
#include "lib/route_types.h"
diff --git a/mgmtd/mgmt.h b/mgmtd/mgmt.h
index d46b1341ec..665e8d8fd8 100644
--- a/mgmtd/mgmt.h
+++ b/mgmtd/mgmt.h
@@ -20,7 +20,6 @@
#include "mgmtd/mgmt_txn.h"
#include "mgmtd/mgmt_ds.h"
-#define MGMTD_VTY_PORT 2623
#define MGMTD_SOCKET_BUF_SIZE 65535
#define MGMTD_MAX_COMMIT_LIST 10
diff --git a/nhrpd/nhrpd.h b/nhrpd/nhrpd.h
index 50653c784a..e389b7489d 100644
--- a/nhrpd/nhrpd.h
+++ b/nhrpd/nhrpd.h
@@ -16,7 +16,6 @@ DECLARE_MGROUP(NHRPD);
#define NHRPD_DEFAULT_HOLDTIME 7200
-#define NHRP_VTY_PORT 2610
#define NHRP_DEFAULT_CONFIG "nhrpd.conf"
extern struct event_loop *master;
diff --git a/ospf6d/ospf6_main.c b/ospf6d/ospf6_main.c
index 6449d68453..17966e741e 100644
--- a/ospf6d/ospf6_main.c
+++ b/ospf6d/ospf6_main.c
@@ -46,9 +46,6 @@
* is excessive for just supporting a legacy compatibility file location
*/
-/* Default port values. */
-#define OSPF6_VTY_PORT 2606
-
/* ospf6d privileges */
zebra_capabilities_t _caps_p[] = {ZCAP_NET_RAW, ZCAP_BIND, ZCAP_SYS_ADMIN};
diff --git a/ospfd/ospf_api.h b/ospfd/ospf_api.h
index 6c8bed3d8f..6160a0f1fa 100644
--- a/ospfd/ospf_api.h
+++ b/ospfd/ospf_api.h
@@ -21,10 +21,6 @@
#define MTYPE_OSPF_API_MSG MTYPE_TMP
#define MTYPE_OSPF_API_FIFO MTYPE_TMP
-/* Default API server port to accept connection request from client-side. */
-/* This value could be overridden by "ospfapi" entry in "/etc/services". */
-#define OSPF_API_SYNC_PORT 2607
-
/* -----------------------------------------------------------
* Generic messages
* -----------------------------------------------------------
diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h
index 2ab7db119e..6051dff709 100644
--- a/ospfd/ospfd.h
+++ b/ospfd/ospfd.h
@@ -22,9 +22,6 @@
#define OSPF_VERSION 2
-/* VTY port number. */
-#define OSPF_VTY_PORT 2604
-
/* IP TTL for OSPF protocol. */
#define OSPF_IP_TTL 1
#define OSPF_VL_IP_TTL 100
diff --git a/pathd/path_main.c b/pathd/path_main.c
index c3409522e2..fe636c51be 100644
--- a/pathd/path_main.c
+++ b/pathd/path_main.c
@@ -95,8 +95,6 @@ static const struct frr_yang_module_info *pathd_yang_modules[] = {
&frr_pathd_info,
};
-#define PATH_VTY_PORT 2621
-
/* clang-format off */
FRR_DAEMON_INFO(pathd, PATH,
.vty_port = PATH_VTY_PORT,
diff --git a/pbrd/pbr_main.c b/pbrd/pbr_main.c
index 8cddf87a27..6695b537a8 100644
--- a/pbrd/pbr_main.c
+++ b/pbrd/pbr_main.c
@@ -103,8 +103,6 @@ struct frr_signal_t pbr_signals[] = {
},
};
-#define PBR_VTY_PORT 2615
-
static const struct frr_yang_module_info *const pbrd_yang_modules[] = {
&frr_filter_info,
&frr_interface_info,
diff --git a/pimd/pimd.h b/pimd/pimd.h
index 9ec84fc0a6..3d9318953b 100644
--- a/pimd/pimd.h
+++ b/pimd/pimd.h
@@ -19,9 +19,6 @@
#include "pim_memory.h"
#include "pim_assert.h"
-#define PIMD_VTY_PORT 2611
-#define PIM6D_VTY_PORT 2622
-
#define PIM_IP_PROTO_IGMP (2)
#define PIM_IP_PROTO_PIM (103)
#define PIM_IGMP_MIN_LEN (8)
diff --git a/ripd/ripd.h b/ripd/ripd.h
index b7e79332fe..08f7a2442d 100644
--- a/ripd/ripd.h
+++ b/ripd/ripd.h
@@ -51,7 +51,6 @@
/* RIP port number. */
#define RIP_PORT_DEFAULT 520
-#define RIP_VTY_PORT 2602
/* Default configuration file name. */
#define RIPD_DEFAULT_CONFIG "ripd.conf"
diff --git a/ripngd/ripngd.h b/ripngd/ripngd.h
index b4f7b4e52d..a316f2b4b5 100644
--- a/ripngd/ripngd.h
+++ b/ripngd/ripngd.h
@@ -16,7 +16,6 @@
/* RIPng version and port number. */
#define RIPNG_V1 1
#define RIPNG_PORT_DEFAULT 521
-#define RIPNG_VTY_PORT 2603
#define RIPNG_MAX_PACKET_SIZE 1500
#define RIPNG_PRIORITY_DEFAULT 0
diff --git a/sharpd/sharp_main.c b/sharpd/sharp_main.c
index 57948388b2..f4ce147978 100644
--- a/sharpd/sharp_main.c
+++ b/sharpd/sharp_main.c
@@ -120,8 +120,6 @@ struct frr_signal_t sharp_signals[] = {
},
};
-#define SHARP_VTY_PORT 2614
-
static const struct frr_yang_module_info *const sharpd_yang_modules[] = {
&frr_filter_info,
&frr_interface_info,
diff --git a/staticd/static_main.c b/staticd/static_main.c
index 1953701fbb..2fd1741948 100644
--- a/staticd/static_main.c
+++ b/staticd/static_main.c
@@ -113,8 +113,6 @@ static const struct frr_yang_module_info *const staticd_yang_modules[] = {
&frr_staticd_info,
};
-#define STATIC_VTY_PORT 2616
-
/*
* NOTE: .flags == FRR_NO_SPLIT_CONFIG to avoid reading split config, mgmtd will
* do this for us now
diff --git a/vrrpd/vrrp_main.c b/vrrpd/vrrp_main.c
index 7f859ca6d2..e9af3d92f5 100644
--- a/vrrpd/vrrp_main.c
+++ b/vrrpd/vrrp_main.c
@@ -107,8 +107,6 @@ static const struct frr_yang_module_info *const vrrp_yang_modules[] = {
&frr_vrrpd_info,
};
-#define VRRP_VTY_PORT 2619
-
/* clang-format off */
FRR_DAEMON_INFO(vrrpd, VRRP,
.vty_port = VRRP_VTY_PORT,
diff --git a/zebra/dplane_fpm_nl.c b/zebra/dplane_fpm_nl.c
index 0931cc788f..7ae1b2a090 100644
--- a/zebra/dplane_fpm_nl.c
+++ b/zebra/dplane_fpm_nl.c
@@ -45,7 +45,6 @@
#include "fpm/fpm.h"
#define SOUTHBOUND_DEFAULT_ADDR INADDR_LOOPBACK
-#define SOUTHBOUND_DEFAULT_PORT 2620
/*
* Time in seconds that if the other end is not responding
@@ -217,7 +216,7 @@ DEFUN(fpm_set_address, fpm_set_address_cmd,
memset(sin, 0, sizeof(*sin));
sin->sin_family = AF_INET;
sin->sin_port =
- port ? htons(port) : htons(SOUTHBOUND_DEFAULT_PORT);
+ port ? htons(port) : htons(FPM_DEFAULT_PORT);
#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
sin->sin_len = sizeof(*sin);
#endif /* HAVE_STRUCT_SOCKADDR_SA_LEN */
@@ -235,7 +234,7 @@ DEFUN(fpm_set_address, fpm_set_address_cmd,
sin6 = (struct sockaddr_in6 *)&gfnc->addr;
memset(sin6, 0, sizeof(*sin6));
sin6->sin6_family = AF_INET6;
- sin6->sin6_port = port ? htons(port) : htons(SOUTHBOUND_DEFAULT_PORT);
+ sin6->sin6_port = port ? htons(port) : htons(FPM_DEFAULT_PORT);
#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
sin6->sin6_len = sizeof(*sin6);
#endif /* HAVE_STRUCT_SOCKADDR_SA_LEN */
@@ -402,7 +401,7 @@ static int fpm_write_config(struct vty *vty)
written = 1;
sin = (struct sockaddr_in *)&gfnc->addr;
vty_out(vty, "fpm address %pI4", &sin->sin_addr);
- if (sin->sin_port != htons(SOUTHBOUND_DEFAULT_PORT))
+ if (sin->sin_port != htons(FPM_DEFAULT_PORT))
vty_out(vty, " port %d", ntohs(sin->sin_port));
vty_out(vty, "\n");
@@ -411,7 +410,7 @@ static int fpm_write_config(struct vty *vty)
written = 1;
sin6 = (struct sockaddr_in6 *)&gfnc->addr;
vty_out(vty, "fpm address %pI6", &sin6->sin6_addr);
- if (sin6->sin6_port != htons(SOUTHBOUND_DEFAULT_PORT))
+ if (sin6->sin6_port != htons(FPM_DEFAULT_PORT))
vty_out(vty, " port %d", ntohs(sin6->sin6_port));
vty_out(vty, "\n");
diff --git a/zebra/zserv.h b/zebra/zserv.h
index 4ab201b5ea..e1c990fb05 100644
--- a/zebra/zserv.h
+++ b/zebra/zserv.h
@@ -31,9 +31,6 @@ extern "C" {
struct zebra_vrf;
-/* Default port information. */
-#define ZEBRA_VTY_PORT 2601
-
/* Default configuration filename. */
#define DEFAULT_CONFIG_FILE "zebra.conf"