Nest: Fix bug in device proto

If an interface address notification is received during device protocol
shutdown/restart, BIRD crashed.

Thanks to Wei Huang for the bugreport.
This commit is contained in:
Ondrej Zajicek (work) 2015-11-23 11:13:40 +01:00
parent fce764f90e
commit 1e4891e48e
3 changed files with 7 additions and 3 deletions

View file

@ -1116,12 +1116,14 @@ nl_async_msg(struct nlmsghdr *h)
case RTM_NEWLINK: case RTM_NEWLINK:
case RTM_DELLINK: case RTM_DELLINK:
DBG("KRT: Received async link notification (%d)\n", h->nlmsg_type); DBG("KRT: Received async link notification (%d)\n", h->nlmsg_type);
nl_parse_link(h, 0); if (kif_proto)
nl_parse_link(h, 0);
break; break;
case RTM_NEWADDR: case RTM_NEWADDR:
case RTM_DELADDR: case RTM_DELADDR:
DBG("KRT: Received async address notification (%d)\n", h->nlmsg_type); DBG("KRT: Received async address notification (%d)\n", h->nlmsg_type);
nl_parse_addr(h, 0); if (kif_proto)
nl_parse_addr(h, 0);
break; break;
default: default:
DBG("KRT: Received unknown async notification (%d)\n", h->nlmsg_type); DBG("KRT: Received unknown async notification (%d)\n", h->nlmsg_type);

View file

@ -84,8 +84,8 @@ krt_io_init(void)
* Interfaces * Interfaces
*/ */
struct kif_proto *kif_proto;
static struct kif_config *kif_cf; static struct kif_config *kif_cf;
static struct kif_proto *kif_proto;
static timer *kif_scan_timer; static timer *kif_scan_timer;
static bird_clock_t kif_last_shot; static bird_clock_t kif_last_shot;

View file

@ -112,6 +112,8 @@ struct kif_proto {
struct kif_state sys; /* Sysdep state */ struct kif_state sys; /* Sysdep state */
}; };
struct kif_proto *kif_proto;
#define KIF_CF ((struct kif_config *)p->p.cf) #define KIF_CF ((struct kif_config *)p->p.cf)
struct proto_config * krt_init_config(int class); struct proto_config * krt_init_config(int class);