Test old instance of BIRD.
This commit is contained in:
parent
cd09226078
commit
41c8976e29
4 changed files with 39 additions and 5 deletions
|
@ -36,12 +36,22 @@ typedef u16 word;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Path to configuration file */
|
/* Path to configuration file */
|
||||||
#ifdef DEBUGGING
|
#ifdef IPV6
|
||||||
#define PATH_CONFIG "bird.conf"
|
# ifdef DEBUGGING
|
||||||
#define PATH_CONTROL_SOCKET "bird.ctl"
|
# define PATH_CONFIG "bird-6.conf"
|
||||||
|
# define PATH_CONTROL_SOCKET "bird-6.ctl"
|
||||||
|
# else
|
||||||
|
# define PATH_CONFIG PATH_CONFIG_DIR "/bird-6.conf"
|
||||||
|
# define PATH_CONTROL_SOCKET PATH_CONTROL_SOCKET_DIR "/bird-6.ctl"
|
||||||
|
# endif
|
||||||
#else
|
#else
|
||||||
#define PATH_CONFIG PATH_CONFIG_DIR "/bird.conf"
|
# ifdef DEBUGGING
|
||||||
#define PATH_CONTROL_SOCKET PATH_CONTROL_SOCKET_DIR "/bird.ctl"
|
# define PATH_CONFIG "bird.conf"
|
||||||
|
# define PATH_CONTROL_SOCKET "bird.ctl"
|
||||||
|
# else
|
||||||
|
# define PATH_CONFIG PATH_CONFIG_DIR "/bird.conf"
|
||||||
|
# define PATH_CONTROL_SOCKET PATH_CONTROL_SOCKET_DIR "/bird.ctl"
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1194,3 +1194,23 @@ io_loop(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
test_old_bird(char *path)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
struct sockaddr_un sa;
|
||||||
|
|
||||||
|
fd = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||||
|
|
||||||
|
if (fd < 0)
|
||||||
|
die("Cannot create socket: %m");
|
||||||
|
bzero(&sa, sizeof(sa));
|
||||||
|
sa.sun_family = AF_UNIX;
|
||||||
|
strcpy(sa.sun_path, path);
|
||||||
|
if (connect(fd, (struct sockaddr *) &sa, SUN_LEN(&sa)) == 0)
|
||||||
|
die("I found another BIRD running.");
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -412,6 +412,8 @@ main(int argc, char **argv)
|
||||||
log_init_debug("");
|
log_init_debug("");
|
||||||
log_init(debug_flag, 1);
|
log_init(debug_flag, 1);
|
||||||
|
|
||||||
|
test_old_bird(path_control_socket);
|
||||||
|
|
||||||
DBG("Initializing.\n");
|
DBG("Initializing.\n");
|
||||||
resource_init();
|
resource_init();
|
||||||
olock_init();
|
olock_init();
|
||||||
|
|
|
@ -46,6 +46,8 @@ void fill_in_sockaddr(sockaddr *sa, ip_addr a, unsigned port);
|
||||||
void get_sockaddr(sockaddr *sa, ip_addr *a, unsigned *port, int check);
|
void get_sockaddr(sockaddr *sa, ip_addr *a, unsigned *port, int check);
|
||||||
int sk_open_unix(struct birdsock *s, char *name);
|
int sk_open_unix(struct birdsock *s, char *name);
|
||||||
void *tracked_fopen(struct pool *, char *name, char *mode);
|
void *tracked_fopen(struct pool *, char *name, char *mode);
|
||||||
|
void test_old_bird(char *path);
|
||||||
|
|
||||||
|
|
||||||
/* krt.c bits */
|
/* krt.c bits */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue