mirror of
https://github.com/systemd/systemd.git
synced 2025-08-29 01:49:55 +03:00
network/nexthop: also remove nexthop on cancelling request
Otherwise, the nexthop may arrive after we call link_drop_foreign_address() or so on reconfiguring interface.
This commit is contained in:
@ -961,6 +961,13 @@ static int link_drop_requests(Link *link) {
|
|||||||
RET_GATHER(ret, neighbor_remove(neighbor, link));
|
RET_GATHER(ret, neighbor_remove(neighbor, link));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case REQUEST_TYPE_NEXTHOP: {
|
||||||
|
NextHop *nexthop = ASSERT_PTR(req->userdata);
|
||||||
|
|
||||||
|
if (nexthop_get_by_id(link->manager, nexthop->id, NULL) < 0)
|
||||||
|
RET_GATHER(ret, nexthop_remove(nexthop, link->manager));
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
@ -424,17 +424,14 @@ static int nexthop_remove_handler(sd_netlink *rtnl, sd_netlink_message *m, Link
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nexthop_remove(NextHop *nexthop) {
|
int nexthop_remove(NextHop *nexthop, Manager *manager) {
|
||||||
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL;
|
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL;
|
||||||
Manager *manager;
|
|
||||||
Link *link = NULL;
|
Link *link = NULL;
|
||||||
Request *req;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(nexthop);
|
assert(nexthop);
|
||||||
assert(nexthop->id > 0);
|
assert(nexthop->id > 0);
|
||||||
|
assert(manager);
|
||||||
manager = ASSERT_PTR(nexthop->manager);
|
|
||||||
|
|
||||||
/* link may be NULL. */
|
/* link may be NULL. */
|
||||||
(void) link_get_by_index(manager, nexthop->ifindex, &link);
|
(void) link_get_by_index(manager, nexthop->ifindex, &link);
|
||||||
@ -457,9 +454,6 @@ static int nexthop_remove(NextHop *nexthop) {
|
|||||||
link_ref(link); /* link may be NULL, link_ref() is OK with that */
|
link_ref(link); /* link may be NULL, link_ref() is OK with that */
|
||||||
|
|
||||||
nexthop_enter_removing(nexthop);
|
nexthop_enter_removing(nexthop);
|
||||||
if (nexthop_get_request_by_id(manager, nexthop->id, &req) >= 0)
|
|
||||||
nexthop_enter_removing(req->userdata);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -780,7 +774,7 @@ int link_drop_nexthops(Link *link, bool foreign) {
|
|||||||
if (!nexthop_is_marked(nexthop))
|
if (!nexthop_is_marked(nexthop))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
RET_GATHER(r, nexthop_remove(nexthop));
|
RET_GATHER(r, nexthop_remove(nexthop, link->manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
|
@ -37,6 +37,8 @@ typedef struct NextHop {
|
|||||||
|
|
||||||
NextHop *nexthop_free(NextHop *nexthop);
|
NextHop *nexthop_free(NextHop *nexthop);
|
||||||
|
|
||||||
|
int nexthop_remove(NextHop *nexthop, Manager *manager);
|
||||||
|
|
||||||
int network_drop_invalid_nexthops(Network *network);
|
int network_drop_invalid_nexthops(Network *network);
|
||||||
|
|
||||||
int link_drop_nexthops(Link *link, bool foreign);
|
int link_drop_nexthops(Link *link, bool foreign);
|
||||||
|
Reference in New Issue
Block a user