ffd_send_update: honour neigh argument
This commit is contained in:
parent
dddfebf366
commit
8cc84b1edb
2 changed files with 8 additions and 6 deletions
|
@ -466,10 +466,7 @@ static void receive_packet(void) {
|
|||
static void send_updates(void) {
|
||||
ffd_iface_t *iface;
|
||||
for (iface = iface_list; iface; iface = iface->next) {
|
||||
ffd_neigh_t *neigh;
|
||||
for (neigh = iface->neigh_list; neigh; neigh = neigh->next) {
|
||||
ffd_send_update(iface, neigh, NULL, false);
|
||||
}
|
||||
ffd_send_update(iface, NULL, NULL, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -192,6 +192,11 @@ void ffd_send_update(ffd_iface_t *iface, ffd_neigh_t *neigh, ffd_announce_t *ann
|
|||
packet->version_magic = htons(FFD_VERSION_MAGIC);
|
||||
packet->len = 0;
|
||||
|
||||
const eth_addr_t *addr = &ffd_addr;
|
||||
|
||||
if (neigh)
|
||||
addr = &neigh->addr;
|
||||
|
||||
if (announce) {
|
||||
add_update(packet, FFD_PACKET_MAX, NULL, announce, with_data);
|
||||
}
|
||||
|
@ -201,7 +206,7 @@ void ffd_send_update(ffd_iface_t *iface, ffd_neigh_t *neigh, ffd_announce_t *ann
|
|||
ffd_announce_t *a;
|
||||
for (a = announce_list; a; a = a->next) {
|
||||
if (!add_update(packet, FFD_PACKET_MAX, &node_id, a, with_data)) {
|
||||
if (!send_eth(&ffd_addr, iface->ifindex, packet, sizeof(ffd_packet_t)+ntohs(packet->len)))
|
||||
if (!send_eth(addr, iface->ifindex, packet, sizeof(ffd_packet_t)+ntohs(packet->len)))
|
||||
fprintf(stderr, "send_eth: %m\n");
|
||||
|
||||
node_id = FFD_NODE_ID_UNSPEC;
|
||||
|
@ -210,7 +215,7 @@ void ffd_send_update(ffd_iface_t *iface, ffd_neigh_t *neigh, ffd_announce_t *ann
|
|||
}
|
||||
|
||||
if (packet->len) {
|
||||
if (!send_eth(&ffd_addr, iface->ifindex, packet, sizeof(ffd_packet_t)+ntohs(packet->len)))
|
||||
if (!send_eth(addr, iface->ifindex, packet, sizeof(ffd_packet_t)+ntohs(packet->len)))
|
||||
fprintf(stderr, "send_eth: %m\n");
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue