Skip to content

Commit

Permalink
build: nuke LDPD_SOCKET
Browse files Browse the repository at this point in the history
This just unnecessarily complicates things by involving autoconf.

Signed-off-by: David Lamparter <[email protected]>
  • Loading branch information
eqvinox committed Jan 27, 2024
1 parent 72783ec commit 0f79e6b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 23 deletions.
1 change: 0 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2736,7 +2736,6 @@ AC_DEFINE_UNQUOTED([FRR_RUNSTATE_PATH], ["$CFG_STATE"], [/run/frr equivalent])
AC_DEFINE_UNQUOTED([YANG_MODELS_PATH], ["$CFG_YANGMODELS"], [path to YANG data models])
AC_DEFINE_UNQUOTED([WATCHFRR_SH_PATH], ["${CFG_SBIN%/}/watchfrr.sh"], [path to watchfrr.sh])

AC_DEFINE_UNQUOTED([LDPD_SOCKET], ["$CFG_STATE%s%s/ldpd.sock"], [ldpd control socket])
AC_DEFINE_UNQUOTED([OSPFD_GR_STATE], ["$CFG_STATE%s/ospfd-gr.json"], [ospfd GR state information])
AC_DEFINE_UNQUOTED([OSPF6D_GR_STATE], ["$CFG_STATE/ospf6d-gr.json"], [ospf6d GR state information])
AC_DEFINE_UNQUOTED([ISISD_RESTART], ["$CFG_STATE%s/isid-restart.json"], [isisd restart information])
Expand Down
6 changes: 6 additions & 0 deletions ldpd/ldp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 5 additions & 22 deletions ldpd/ldpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,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];

Expand All @@ -263,21 +259,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);
Expand All @@ -295,9 +278,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));
Expand Down

0 comments on commit 0f79e6b

Please sign in to comment.