mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-03 05:21:31 +00:00
lib: Add set_socket_path() to sockopt.c to override the path element of a (vty) socket (but keep filename)
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
This commit is contained in:
parent
780cff2f08
commit
950765ba10
@ -29,6 +29,29 @@
|
||||
#include "sockopt.h"
|
||||
#include "sockunion.h"
|
||||
|
||||
/* Replace the path of given defaultpath with newpath, but keep filename */
|
||||
void
|
||||
set_socket_path (char *path, char *defaultpath, char *newpath, int maxsize)
|
||||
{
|
||||
char *sock_name;
|
||||
|
||||
sock_name = strrchr(defaultpath, '/');
|
||||
if (sock_name)
|
||||
/* skip '/' */
|
||||
sock_name++;
|
||||
else
|
||||
/*
|
||||
* VTYSH_PATH configured as relative path
|
||||
* during config? Should really never happen for
|
||||
* sensible config
|
||||
*/
|
||||
sock_name = defaultpath;
|
||||
|
||||
strlcpy (path, newpath, maxsize);
|
||||
strlcat (path, "/", maxsize);
|
||||
strlcat (path, sock_name, maxsize);
|
||||
}
|
||||
|
||||
void
|
||||
setsockopt_so_recvbuf (int sock, int size)
|
||||
{
|
||||
|
@ -24,6 +24,9 @@
|
||||
|
||||
#include "sockunion.h"
|
||||
|
||||
/* Override (vty) socket paths, but keep the filename */
|
||||
extern void set_socket_path (char *path, char *defaultpath, char *newpath, int maxsize);
|
||||
|
||||
extern void setsockopt_so_recvbuf (int sock, int size);
|
||||
extern void setsockopt_so_sendbuf (const int sock, int size);
|
||||
extern int getsockopt_so_sendbuf (const int sock);
|
||||
|
Loading…
Reference in New Issue
Block a user