Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: fix a pile of directory and/or state retention related issues #15243

Merged
merged 19 commits into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ MODULE_LDFLAGS = \
$(SAN_FLAGS) \
# end

DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" -DCONFDATE=$(CONFDATE)
DEFS = @DEFS@ -DCONFDATE=$(CONFDATE)

AR_FLAGS = @AR_FLAGS@
ARFLAGS = @ARFLAGS@
Expand Down
6 changes: 2 additions & 4 deletions alpine/APKBUILD.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,18 @@ source="$pkgname-$pkgver.tar.gz"
builddir="$srcdir"/$pkgname-$pkgver

_sbindir=/usr/lib/frr
_sysconfdir=/etc/frr
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lots of developers probably have custom scripts to set this up for themselves. Do we need to have them change anything?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_libdir=/usr/lib
_localstatedir=/var/run/frr
_user=frr

build() {
cd "$builddir"

./configure \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--sbindir=$_sbindir \
--sysconfdir=$_sysconfdir \
--libdir=$_libdir \
--localstatedir=$_localstatedir \
--enable-rpki \
--enable-vtysh \
--enable-multipath=64 \
Expand Down
23 changes: 12 additions & 11 deletions babeld/babel_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ unsigned char protocol_group[16]; /* babel's link-local multicast address */
int protocol_port; /* babel's port */
int protocol_socket = -1; /* socket: communicate with others babeld */

static const char babel_config_default[] = SYSCONFDIR BABEL_DEFAULT_CONFIG;
static char *babel_vty_addr = NULL;
static int babel_vty_port = BABEL_VTY_PORT;

Expand Down Expand Up @@ -126,18 +125,20 @@ static const struct frr_yang_module_info *const babeld_yang_modules[] = {
&frr_vrf_info,
};

/* clang-format off */
FRR_DAEMON_INFO(babeld, BABELD,
.vty_port = BABEL_VTY_PORT,
.proghelp = "Implementation of the BABEL routing protocol.",
.vty_port = BABEL_VTY_PORT,
.proghelp = "Implementation of the BABEL routing protocol.",

.signals = babel_signals,
.n_signals = array_size(babel_signals),
.signals = babel_signals,
.n_signals = array_size(babel_signals),

.privs = &babeld_privs,
.privs = &babeld_privs,

.yang_modules = babeld_yang_modules,
.n_yang_modules = array_size(babeld_yang_modules),
.yang_modules = babeld_yang_modules,
.n_yang_modules = array_size(babeld_yang_modules),
);
/* clang-format on */

int
main(int argc, char **argv)
Expand Down Expand Up @@ -171,8 +172,8 @@ main(int argc, char **argv)
}
}

snprintf(state_file, sizeof(state_file), "%s/%s",
frr_vtydir, "babel-state");
snprintf(state_file, sizeof(state_file), "%s/%s", frr_runstatedir,
"babel-state");

/* create the threads handler */
master = frr_init ();
Expand Down Expand Up @@ -366,7 +367,7 @@ show_babel_main_configuration (struct vty *vty)
"id = %s\n"
"kernel_metric = %d\n",
state_file,
babeld_di.config_file ? babeld_di.config_file : babel_config_default,
babeld_di.config_file,
format_address(protocol_group),
protocol_port,
babel_vty_addr ? babel_vty_addr : "None",
Expand Down
2 changes: 2 additions & 0 deletions bfdd/bfd.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ DECLARE_MGROUP(BFDD);
DECLARE_MTYPE(BFDD_CONTROL);
DECLARE_MTYPE(BFDD_NOTIFICATION);

#define BFDD_SOCK_NAME "%s/bfdd.sock", frr_runstatedir

/* bfd Authentication Type. */
#define BFD_AUTH_NULL 0
#define BFD_AUTH_SIMPLE 1
Expand Down
26 changes: 15 additions & 11 deletions bfdd/bfdd.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,20 @@ static const struct frr_yang_module_info *const bfdd_yang_modules[] = {
&frr_vrf_info,
};

FRR_DAEMON_INFO(bfdd, BFD, .vty_port = 2617,
.proghelp = "Implementation of the BFD protocol.",
.signals = bfd_signals, .n_signals = array_size(bfd_signals),
.privs = &bglobal.bfdd_privs,
.yang_modules = bfdd_yang_modules,
.n_yang_modules = array_size(bfdd_yang_modules),
/* clang-format off */
FRR_DAEMON_INFO(bfdd, BFD,
.vty_port = 2617,
.proghelp = "Implementation of the BFD protocol.",

.signals = bfd_signals,
.n_signals = array_size(bfd_signals),

.privs = &bglobal.bfdd_privs,

.yang_modules = bfdd_yang_modules,
.n_yang_modules = array_size(bfdd_yang_modules),
);
/* clang-format on */

#define OPTION_CTLSOCK 1001
#define OPTION_DPLANEADDR 2000
Expand Down Expand Up @@ -335,8 +342,6 @@ int main(int argc, char *argv[])
" --bfdctl Specify bfdd control socket\n"
" --dplaneaddr Specify BFD data plane address\n");

snprintf(ctl_path, sizeof(ctl_path), BFDD_CONTROL_SOCKET,
"", "");
while (true) {
opt = frr_getopt(argc, argv, NULL);
if (opt == EOF)
Expand All @@ -357,9 +362,8 @@ int main(int argc, char *argv[])
}
}

if (bfdd_di.pathspace && !ctlsockused)
snprintf(ctl_path, sizeof(ctl_path), BFDD_CONTROL_SOCKET,
"/", bfdd_di.pathspace);
if (!ctlsockused)
snprintf(ctl_path, sizeof(ctl_path), BFDD_SOCK_NAME);

/* Initialize FRR infrastructure. */
master = frr_init();
Expand Down
6 changes: 3 additions & 3 deletions bfdd/control.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ int control_init(const char *path)
mode_t umval;
struct sockaddr_un sun_ = {
.sun_family = AF_UNIX,
.sun_path = BFDD_CONTROL_SOCKET,
};

if (path)
strlcpy(sun_.sun_path, path, sizeof(sun_.sun_path));
assert(path);

strlcpy(sun_.sun_path, path, sizeof(sun_.sun_path));

/* Remove previously created sockets. */
unlink(sun_.sun_path);
Expand Down
15 changes: 10 additions & 5 deletions bgpd/bgp_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,15 +385,20 @@ static const struct frr_yang_module_info *const bgpd_yang_modules[] = {
&frr_bgp_route_map_info,
};

FRR_DAEMON_INFO(bgpd, BGP, .vty_port = BGP_VTY_PORT,
/* clang-format off */
FRR_DAEMON_INFO(bgpd, BGP,
.vty_port = BGP_VTY_PORT,
.proghelp = "Implementation of the BGP routing protocol.",

.proghelp = "Implementation of the BGP routing protocol.",
.signals = bgp_signals,
.n_signals = array_size(bgp_signals),

.signals = bgp_signals, .n_signals = array_size(bgp_signals),
.privs = &bgpd_privs,

.privs = &bgpd_privs, .yang_modules = bgpd_yang_modules,
.n_yang_modules = array_size(bgpd_yang_modules),
.yang_modules = bgpd_yang_modules,
.n_yang_modules = array_size(bgpd_yang_modules),
);
/* clang-format on */

#define DEPRECATED_OPTIONS ""

Expand Down
2 changes: 1 addition & 1 deletion buildtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# builds some git commit of FRR in some different configurations
# usage: buildtest.sh [commit [configurations...]]

basecfg="--prefix=/usr --enable-user=frr --enable-group=frr --enable-vty-group=frr --enable-configfile-mask=0660 --enable-logfile-mask=0640 --enable-vtysh --sysconfdir=/etc/frr --localstatedir=/var/run/frr --libdir=/usr/lib64/frr --enable-rtadv --disable-static --enable-isisd --enable-multipath=0 --enable-pimd --enable-werror"
basecfg="--prefix=/usr --enable-user=frr --enable-group=frr --enable-vty-group=frr --enable-configfile-mask=0660 --enable-logfile-mask=0640 --enable-vtysh --sysconfdir=/etc --localstatedir=/var --libdir=/usr/lib64/frr --enable-rtadv --disable-static --enable-isisd --enable-multipath=0 --enable-pimd --enable-werror"

configs_base="gcc|$basecfg"

Expand Down
Loading
Loading