diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-03-20 05:22:09 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-03-20 05:22:09 +0100 |
commit | 06eae18f7d8fee5541b8a8fba949c24bf92f952c (patch) | |
tree | 87671ce114360421de5a1a868286f807025c2f8d | |
parent | 2396dd4211c17d9f15567f148db95d6fa4083b5f (diff) | |
download | fastd-06eae18f7d8fee5541b8a8fba949c24bf92f952c.tar fastd-06eae18f7d8fee5541b8a8fba949c24bf92f952c.zip |
peer: add assertion to ensure no addresses are learned on unestablished peers
-rw-r--r-- | src/peer.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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); |