From 8cc84b1edb86875fd341e2198aa8ff36b3f5a0f5 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 7 Oct 2012 04:07:38 +0200 Subject: ffd_send_update: honour neigh argument --- ffd/ffd.c | 5 +---- ffd/send.c | 9 +++++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ffd/ffd.c b/ffd/ffd.c index 1a31298..e878eb5 100644 --- a/ffd/ffd.c +++ b/ffd/ffd.c @@ -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); } } diff --git a/ffd/send.c b/ffd/send.c index ac5b250..c42b642 100644 --- a/ffd/send.c +++ b/ffd/send.c @@ -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"); } } -- cgit v1.2.3