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

[WIP] Add manual reload functionality to mrouted for hotplugged network interfaces #63

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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: 2 additions & 0 deletions src/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ extern int mrt_table_id;
extern int debug_list(int, char *, size_t);
extern int debug_parse(char *);
extern void restart(void);
extern void reload_iface(void);
extern char * scaletime(time_t);
extern int register_input_handler(int, ihfunc_t);
extern void deregister_input_handler(int);
Expand Down Expand Up @@ -452,6 +453,7 @@ extern int pidfile(const char *basename);
#define IPC_SHOW_MFC_CMD 21
#define IPC_SHOW_NEIGH_CMD 22
#define IPC_SHOW_ROUTES_CMD 23
#define IPC_RELOAD_IFACE_CMD 30
#define IPC_SHOW_COMPAT_CMD 250
#define IPC_EOF_CMD 254
#define IPC_ERR_CMD 255
Expand Down
4 changes: 4 additions & 0 deletions src/ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,10 @@ static void ipc_handle(int sd)
restart();
break;

case IPC_RELOAD_IFACE_CMD:
reload_iface();
break;

case IPC_DEBUG_CMD:
ipc_generic(client, &msg, do_debug, &msg);
break;
Expand Down
45 changes: 45 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,51 @@ void restart(void)
timer_set(TIMER_INTERVAL, timer, NULL);
}

/*
* Reload ifaces
*/
void reload_iface(void)
{
FILE *fp = NULL;
char *s = NULL;

s = strdup (" reload");
if (s == NULL)
logit(LOG_ERR, 0, "out of memory");

/*
* reset all the entries, except routes and prunes
*/
timer_stop_all();
stop_all_vifs();
k_stop_dvmrp();
igmp_exit();
#ifndef IOCTL_OK_ON_RAW_SOCKET
close(udp_socket);
#endif
did_final_init = 0;

/*
* start processing again
*/
init_genid();

igmp_init();
init_routes();
init_ktable();
init_vifs();
/*XXX Schedule final_init() as main does? */
final_init(s);

/* Touch PID file to acknowledge SIGHUP */
pidfile(pid_file);

/* schedule timer interrupts */
timer_set(1, fasttimer, NULL);
timer_set(TIMER_INTERVAL, timer, NULL);
}


#define SCALETIMEBUFLEN 27
char *scaletime(time_t t)
{
Expand Down
Loading