diff options
author | Josh Blum <josh@joshknows.com> | 2010-11-21 13:36:25 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-12-11 18:43:09 -0800 |
commit | 6004410a7b73a52d95b8f5f0cf0fa969bef4e910 (patch) | |
tree | 0f3cfd706b992c9008a90b75d9eb2315d4f8b7c6 /firmware/microblaze/lib/net_common.c | |
parent | fe35b8ae0785fff7d33e18b62e3b435cfd5a5475 (diff) | |
download | uhd-6004410a7b73a52d95b8f5f0cf0fa969bef4e910.tar.gz uhd-6004410a7b73a52d95b8f5f0cf0fa969bef4e910.tar.bz2 uhd-6004410a7b73a52d95b8f5f0cf0fa969bef4e910.zip |
packet_router: implemented code to program the addresses into the router
Diffstat (limited to 'firmware/microblaze/lib/net_common.c')
-rw-r--r-- | firmware/microblaze/lib/net_common.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/firmware/microblaze/lib/net_common.c b/firmware/microblaze/lib/net_common.c index 48aa460f9..e9b633b13 100644 --- a/firmware/microblaze/lib/net_common.c +++ b/firmware/microblaze/lib/net_common.c @@ -39,21 +39,12 @@ static const eth_mac_addr_t BCAST_MAC_ADDR = {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}; -static inline bool -ip_addr_eq(const struct ip_addr a, const struct ip_addr b) -{ - return a.addr == b.addr; -} - // ------------------------------------------------------------------------ static eth_mac_addr_t _local_mac_addr; -void register_mac_addr(const eth_mac_addr_t *mac_addr){ - _local_mac_addr = *mac_addr; -} - static struct ip_addr _local_ip_addr; -void register_ip_addr(const struct ip_addr *ip_addr){ +void register_addrs(const eth_mac_addr_t *mac_addr, const struct ip_addr *ip_addr){ + _local_mac_addr = *mac_addr; _local_ip_addr = *ip_addr; } @@ -382,7 +373,7 @@ handle_arp_packet(struct arp_eth_ipv4 *p, size_t size) sip.addr = get_int32(p->ar_sip); tip.addr = get_int32(p->ar_tip); - if (ip_addr_eq(tip, _local_ip_addr)){ // They're looking for us... + if (memcmp(&tip, &_local_ip_addr, sizeof(_local_ip_addr)) == 0){ // They're looking for us... send_arp_reply(p, _local_mac_addr); } } |