ffd_send_update: honour neigh argument

This commit is contained in:
Matthias Schiffer 2012-10-07 04:07:38 +02:00
parent dddfebf366
commit 8cc84b1edb
2 changed files with 8 additions and 6 deletions

View file

@ -466,10 +466,7 @@ static void receive_packet(void) {
static void send_updates(void) { static void send_updates(void) {
ffd_iface_t *iface; ffd_iface_t *iface;
for (iface = iface_list; iface; iface = iface->next) { for (iface = iface_list; iface; iface = iface->next) {
ffd_neigh_t *neigh; ffd_send_update(iface, NULL, NULL, false);
for (neigh = iface->neigh_list; neigh; neigh = neigh->next) {
ffd_send_update(iface, neigh, NULL, false);
}
} }
} }

View file

@ -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->version_magic = htons(FFD_VERSION_MAGIC);
packet->len = 0; packet->len = 0;
const eth_addr_t *addr = &ffd_addr;
if (neigh)
addr = &neigh->addr;
if (announce) { if (announce) {
add_update(packet, FFD_PACKET_MAX, NULL, announce, with_data); 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; ffd_announce_t *a;
for (a = announce_list; a; a = a->next) { for (a = announce_list; a; a = a->next) {
if (!add_update(packet, FFD_PACKET_MAX, &node_id, a, with_data)) { 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"); fprintf(stderr, "send_eth: %m\n");
node_id = FFD_NODE_ID_UNSPEC; 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 (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"); fprintf(stderr, "send_eth: %m\n");
} }
} }