summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-10-07 04:07:38 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-10-07 04:07:38 +0200
commit8cc84b1edb86875fd341e2198aa8ff36b3f5a0f5 (patch)
treecbb66c4abea047c81138bbf3f698b4cf78a5cc6f
parentdddfebf3661b2d99d3483f5b9503364dd891e013 (diff)
downloadffd-8cc84b1edb86875fd341e2198aa8ff36b3f5a0f5.tar
ffd-8cc84b1edb86875fd341e2198aa8ff36b3f5a0f5.zip
ffd_send_update: honour neigh argument
-rw-r--r--ffd/ffd.c5
-rw-r--r--ffd/send.c9
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");
}
}