Commit 889ef335 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Make it possible to compile-out the local interface.

Run make EXTRA_DEFINES=-DNO_LOCAL_INTERFACE.
parent 95d3784a
...@@ -200,9 +200,11 @@ main(int argc, char **argv) ...@@ -200,9 +200,11 @@ main(int argc, char **argv)
} else if(strcmp(*arg, "-d") == 0) { } else if(strcmp(*arg, "-d") == 0) {
SHIFTE(); SHIFTE();
debug = atoi(*arg); debug = atoi(*arg);
#ifndef NO_LOCAL_INTERFACE
} else if(strcmp(*arg, "-g") == 0) { } else if(strcmp(*arg, "-g") == 0) {
SHIFTE(); SHIFTE();
local_server_port = atoi(*arg); local_server_port = atoi(*arg);
#endif
} else if(strcmp(*arg, "-l") == 0) { } else if(strcmp(*arg, "-l") == 0) {
link_detect = 1; link_detect = 1;
} else if(strcmp(*arg, "-w") == 0) { } else if(strcmp(*arg, "-w") == 0) {
...@@ -509,6 +511,7 @@ main(int argc, char **argv) ...@@ -509,6 +511,7 @@ main(int argc, char **argv)
SHIFT(); SHIFT();
} }
#ifndef NO_LOCAL_INTERFACE
if(local_server_port >= 0) { if(local_server_port >= 0) {
local_server_socket = tcp_server_socket(local_server_port, 1); local_server_socket = tcp_server_socket(local_server_port, 1);
if(local_server_socket < 0) { if(local_server_socket < 0) {
...@@ -516,6 +519,7 @@ main(int argc, char **argv) ...@@ -516,6 +519,7 @@ main(int argc, char **argv)
goto fail; goto fail;
} }
} }
#endif
init_signals(); init_signals();
resize_receive_buffer(1500); resize_receive_buffer(1500);
...@@ -584,6 +588,7 @@ main(int argc, char **argv) ...@@ -584,6 +588,7 @@ main(int argc, char **argv)
FD_SET(kernel_socket, &readfds); FD_SET(kernel_socket, &readfds);
maxfd = MAX(maxfd, kernel_socket); maxfd = MAX(maxfd, kernel_socket);
} }
#ifndef NO_LOCAL_INTERFACE
if(local_socket >= 0) { if(local_socket >= 0) {
FD_SET(local_socket, &readfds); FD_SET(local_socket, &readfds);
maxfd = MAX(maxfd, local_socket); maxfd = MAX(maxfd, local_socket);
...@@ -591,6 +596,7 @@ main(int argc, char **argv) ...@@ -591,6 +596,7 @@ main(int argc, char **argv)
FD_SET(local_server_socket, &readfds); FD_SET(local_server_socket, &readfds);
maxfd = MAX(maxfd, local_server_socket); maxfd = MAX(maxfd, local_server_socket);
} }
#endif
rc = select(maxfd + 1, &readfds, NULL, NULL, &tv); rc = select(maxfd + 1, &readfds, NULL, NULL, &tv);
if(rc < 0) { if(rc < 0) {
if(errno != EINTR) { if(errno != EINTR) {
...@@ -634,6 +640,7 @@ main(int argc, char **argv) ...@@ -634,6 +640,7 @@ main(int argc, char **argv)
} }
} }
#ifndef NO_LOCAL_INTERFACE
if(local_server_socket >= 0 && if(local_server_socket >= 0 &&
FD_ISSET(local_server_socket, &readfds)) { FD_ISSET(local_server_socket, &readfds)) {
if(local_socket >= 0) { if(local_socket >= 0) {
...@@ -658,6 +665,7 @@ main(int argc, char **argv) ...@@ -658,6 +665,7 @@ main(int argc, char **argv)
local_socket = -1; local_socket = -1;
} }
} }
#endif
if(changed) { if(changed) {
kernel_dump_time = now.tv_sec; kernel_dump_time = now.tv_sec;
......
...@@ -35,6 +35,12 @@ THE SOFTWARE. ...@@ -35,6 +35,12 @@ THE SOFTWARE.
#include "util.h" #include "util.h"
#include "local.h" #include "local.h"
#ifdef NO_LOCAL_INTERFACE
int dummy;
#else
int int
local_read(int s) local_read(int s)
{ {
...@@ -247,3 +253,5 @@ local_dump() ...@@ -247,3 +253,5 @@ local_dump()
shutdown(local_socket, 1); shutdown(local_socket, 1);
return; return;
} }
#endif
...@@ -28,9 +28,20 @@ struct xroute; ...@@ -28,9 +28,20 @@ struct xroute;
#define LOCAL_ADD 1 #define LOCAL_ADD 1
#define LOCAL_CHANGE 2 #define LOCAL_CHANGE 2
#ifndef NO_LOCAL_INTERFACE
int local_read(int s); int local_read(int s);
void local_notify_self(void); void local_notify_self(void);
void local_notify_neighbour(struct neighbour *neigh, int kind); void local_notify_neighbour(struct neighbour *neigh, int kind);
void local_notify_xroute(struct xroute *xroute, int kind); void local_notify_xroute(struct xroute *xroute, int kind);
void local_notify_route(struct route *route, int kind); void local_notify_route(struct route *route, int kind);
void local_dump(void); void local_dump(void);
#else
#define local_notify_self() do {} while(0)
#define local_notify_neighbour(n, k) do {} while(0)
#define local_notify_xroute(x, k) do {} while(0)
#define local_notify_route(r, k) do {} while(0)
#define local_dump() do {} while 0
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment