From b8a230e478d41def757344bbe1eee7fa886682e5 Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Tue, 4 Apr 2023 16:41:55 +0200 Subject: Interface subsystem locking --- sysdep/bsd/krt-sock.c | 5 ++++- sysdep/linux/netlink.c | 7 +++---- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'sysdep') diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c index ca1c9e89..e7b21474 100644 --- a/sysdep/bsd/krt-sock.c +++ b/sysdep/bsd/krt-sock.c @@ -277,14 +277,17 @@ krt_send_route(struct krt_proto *p, int cmd, const rte *e) */ if (!i) { - WALK_LIST(j, iface_list) + j = if_walk_first(); + while (j) { if (j->flags & IF_LOOPBACK) { i = j; break; } + j = if_walk_next(j); } + if_walk_done(); if (!i) { diff --git a/sysdep/linux/netlink.c b/sysdep/linux/netlink.c index 0609fde8..b18cb899 100644 --- a/sysdep/linux/netlink.c +++ b/sysdep/linux/netlink.c @@ -1283,8 +1283,7 @@ kif_do_scan(struct kif_proto *p UNUSED) log(L_DEBUG "nl_scan_ifaces: Unknown packet received (type=%d)", h->nlmsg_type); /* Re-resolve master interface for slaves */ - struct iface *i; - WALK_LIST(i, iface_list) + IFACE_WALK(i) if (i->master_index) { struct iface f = { @@ -1292,13 +1291,13 @@ kif_do_scan(struct kif_proto *p UNUSED) .mtu = i->mtu, .index = i->index, .master_index = i->master_index, - .master = if_find_by_index(i->master_index) + .master = if_find_by_index_locked(i->master_index) }; if (f.master != i->master) { memcpy(f.name, i->name, sizeof(f.name)); - if_update(&f); + if_update_locked(&f); } } -- cgit v1.2.3