Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/remote_ieee80211.c

    r3e6bca8 rfafb8e5  
    11/*
    2  * Copyright (c) 2021 Jiri Svoboda
    32 * Copyright (c) 2015 Jan Kolarik
    43 * All rights reserved.
     
    8584}
    8685
    87 // XXX This is wrong. Wifi should not have anything to do with IP links
     86static bool mac_matches(uint8_t *mac1, uint8_t *mac2)
     87{
     88        for (size_t i = 0; i < ETH_ADDR; i++) {
     89                if (mac1[i] != mac2[i])
     90                        return false;
     91        }
     92
     93        return true;
     94}
     95
    8896static sysarg_t get_link_id(uint8_t *mac)
    8997{
    9098        sysarg_t *link_list;
    9199        inet_link_info_t link_info;
    92         eth_addr_t eth_addr;
    93100        size_t count;
    94 
    95         eth_addr_decode(mac, &eth_addr);
    96101
    97102        errno_t rc = inetcfg_get_link_list(&link_list, &count);
     
    104109                        return -1;
    105110
    106                 if (eth_addr_compare(&eth_addr, &link_info.mac_addr) == 0)
     111                if (mac_matches(mac, link_info.mac_addr))
    107112                        return link_list[i];
    108113        }
     
    165170                return rc;
    166171
    167         // XXX This is wrong. Wifi should not initiate DHCP
    168 
    169172        /* Send DHCP discover. */
    170173        nic_address_t wifi_mac;
     
    204207        if (rc != EOK)
    205208                return rc;
    206 
    207         eth_addr_t eth_addr;
    208         eth_addr_decode(wifi_mac.address, &eth_addr);
    209209
    210210        inet_link_info_t link_info;
     
    215215        size_t count;
    216216
    217         /// XXX This is wrong. Wifi should do nothing with DHCP
    218 
    219217        /* Remove previous DHCP address. */
    220218        rc = inetcfg_get_addr_list(&addr_list, &count);
     
    231229                        return rc;
    232230
    233                 if (eth_addr_compare(&eth_addr, &link_info.mac_addr) == 0) {
     231                if (mac_matches(wifi_mac.address, link_info.mac_addr)) {
    234232                        if (str_test_prefix(addr_info.name, "dhcp")) {
    235233                                rc = inetcfg_addr_delete(addr_list[i]);
Note: See TracChangeset for help on using the changeset viewer.