summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-03-20 05:22:09 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-03-20 05:22:09 +0100
commit06eae18f7d8fee5541b8a8fba949c24bf92f952c (patch)
tree87671ce114360421de5a1a868286f807025c2f8d
parent2396dd4211c17d9f15567f148db95d6fa4083b5f (diff)
downloadfastd-06eae18f7d8fee5541b8a8fba949c24bf92f952c.tar
fastd-06eae18f7d8fee5541b8a8fba949c24bf92f952c.zip
peer: add assertion to ensure no addresses are learned on unestablished peers
-rw-r--r--src/peer.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/peer.c b/src/peer.c
index 96463a9..82d5fa4 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -674,6 +674,9 @@ static inline fastd_peer_eth_addr_t* peer_get_by_addr(fastd_context_t *ctx, fast
void fastd_peer_eth_addr_add(fastd_context_t *ctx, fastd_peer_t *peer, fastd_eth_addr_t addr) {
int min = 0, max = ctx->n_eth_addr;
+ if (!fastd_peer_is_established(peer))
+ exit_bug(ctx, "tried to learn ethernet address on non-established peer");
+
while (max > min) {
int cur = (min+max)/2;
int cmp = fastd_eth_addr_cmp(&addr, &ctx->eth_addr[cur].addr);