Fixes missing unregister of kernel table handling code.

And some minor fixes.

Thanks to Sergey Popovich for the patch.
This commit is contained in:
Ondrej Zajicek 2013-09-26 17:33:00 +02:00
parent f515e22924
commit f83ce94d5e
2 changed files with 7 additions and 7 deletions

View file

@ -231,7 +231,7 @@ neigh_up(neighbor *n, struct iface *i, int scope)
static void static void
neigh_down(neighbor *n) neigh_down(neighbor *n)
{ {
DBG("Flushing neighbor %I on %s\n", n->addr, i->name); DBG("Flushing neighbor %I on %s\n", n->addr, n->iface->name);
rem_node(&n->if_n); rem_node(&n->if_n);
if (! (n->flags & NEF_BIND)) if (! (n->flags & NEF_BIND))
n->iface = NULL; n->iface = NULL;

View file

@ -7,6 +7,7 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/uio.h> #include <sys/uio.h>
@ -1040,11 +1041,9 @@ nl_open_async(void)
sock *sk; sock *sk;
struct sockaddr_nl sa; struct sockaddr_nl sa;
int fd; int fd;
static int nl_open_tried = 0;
if (nl_open_tried) if (nl_async_sk)
return; return;
nl_open_tried = 1;
DBG("KRT: Opening async netlink socket\n"); DBG("KRT: Opening async netlink socket\n");
@ -1065,18 +1064,18 @@ nl_open_async(void)
if (bind(fd, (struct sockaddr *) &sa, sizeof(sa)) < 0) if (bind(fd, (struct sockaddr *) &sa, sizeof(sa)) < 0)
{ {
log(L_ERR "Unable to bind asynchronous rtnetlink socket: %m"); log(L_ERR "Unable to bind asynchronous rtnetlink socket: %m");
close(fd);
return; return;
} }
nl_async_rx_buffer = xmalloc(NL_RX_SIZE);
sk = nl_async_sk = sk_new(krt_pool); sk = nl_async_sk = sk_new(krt_pool);
sk->type = SK_MAGIC; sk->type = SK_MAGIC;
sk->rx_hook = nl_async_hook; sk->rx_hook = nl_async_hook;
sk->fd = fd; sk->fd = fd;
if (sk_open(sk)) if (sk_open(sk))
bug("Netlink: sk_open failed"); bug("Netlink: sk_open failed");
if (!nl_async_rx_buffer)
nl_async_rx_buffer = xmalloc(NL_RX_SIZE);
} }
/* /*
@ -1097,6 +1096,7 @@ krt_sys_start(struct krt_proto *p)
void void
krt_sys_shutdown(struct krt_proto *p UNUSED) krt_sys_shutdown(struct krt_proto *p UNUSED)
{ {
nl_table_map[KRT_CF->sys.table_id] = NULL;
} }
int int