Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/ethip/ethip_nic.c

    re82b37e rfafb8e5  
    11/*
    2  * Copyright (c) 2024 Jiri Svoboda
     2 * Copyright (c) 2012 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    3737#include <adt/list.h>
    3838#include <async.h>
     39#include <stdbool.h>
    3940#include <errno.h>
     41#include <str_error.h>
    4042#include <fibril_synch.h>
    41 #include <inet/eth_addr.h>
    4243#include <inet/iplink_srv.h>
    4344#include <io/log.h>
    4445#include <loc.h>
     46#include <nic_iface.h>
     47#include <stdlib.h>
    4548#include <mem.h>
    46 #include <nic_iface.h>
    47 #include <stdbool.h>
    48 #include <stdlib.h>
    49 #include <str_error.h>
    5049#include "ethip.h"
    5150#include "ethip_nic.h"
     
    194193        }
    195194
    196         eth_addr_decode(nic_address.address, &nic->mac_addr);
     195        addr48(nic_address.address, nic->mac_addr);
    197196
    198197        rc = nic_set_state(nic->sess, NIC_STATE_ACTIVE);
     
    234233        uint8_t *addr;
    235234        size_t size;
    236         eth_addr_str_t saddr;
    237235        errno_t rc;
    238236
     
    243241        }
    244242
    245         eth_addr_decode(addr, &nic->mac_addr);
    246         eth_addr_format(&nic->mac_addr, &saddr);
    247 
    248243        log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_addr_changed(): "
    249             "new addr=%s", saddr.str);
     244            "new addr=%02x:%02x:%02x:%02x:%02x:%02x",
     245            addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
     246
     247        memcpy(&nic->mac_addr, addr, sizeof(nic->mac_addr));
    250248
    251249        rc = iplink_ev_change_addr(&nic->iplink, &nic->mac_addr);
     
    401399                assert(i < count);
    402400
    403                 eth_addr_t mac;
    404                 eth_addr_solicited_node(v6, &mac);
     401                addr48_t mac;
     402                addr48_solicited_node(v6, mac);
    405403
    406404                /* Avoid duplicate addresses in the list */
     
    409407
    410408                for (size_t j = 0; j < i; j++) {
    411                         eth_addr_t mac_entry;
    412                         eth_addr_decode(mac_list[j].address, &mac_entry);
    413                         if (eth_addr_compare(&mac_entry, &mac)) {
     409                        if (addr48_compare(mac_list[j].address, mac)) {
    414410                                found = true;
    415411                                break;
     
    418414
    419415                if (!found) {
    420                         eth_addr_encode(&mac, mac_list[i].address);
     416                        addr48(mac, mac_list[i].address);
    421417                        i++;
    422                 } else {
     418                } else
    423419                        count--;
    424                 }
    425420        }
    426421
Note: See TracChangeset for help on using the changeset viewer.