Changeset d5ed54b in mainline


Ignore:
Timestamp:
2021-08-08T08:31:02Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b4edc96
Parents:
f05edcb
Message:

Use assignment operator to copy Ethernet addresses

Location:
uspace
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/inet/include/inet/addr.h

    rf05edcb rd5ed54b  
    8686extern const addr48_t addr48_broadcast;
    8787
    88 extern void addr48(const addr48_t *, addr48_t *);
    8988extern void addr128(const addr128_t, addr128_t);
    9089
  • uspace/lib/inet/src/addr.c

    rf05edcb rd5ed54b  
    7171        .addr6 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
    7272};
    73 
    74 void addr48(const addr48_t *src, addr48_t *dst)
    75 {
    76         memcpy(dst, src, sizeof(addr48_t));
    77 }
    7873
    7974void addr128(const addr128_t src, addr128_t dst)
  • uspace/srv/net/ethip/arp.c

    rf05edcb rd5ed54b  
    8585
    8686                reply.opcode = aop_reply;
    87                 addr48(&nic->mac_addr, &reply.sender_hw_addr);
     87                reply.sender_hw_addr = nic->mac_addr;
    8888                reply.sender_proto_addr = laddr_v4;
    89                 addr48(&packet.sender_hw_addr, &reply.target_hw_addr);
     89                reply.target_hw_addr = packet.sender_hw_addr;
    9090                reply.target_proto_addr = packet.sender_proto_addr;
    9191
     
    9999        /* Broadcast address */
    100100        if (ip_addr == addr32_broadcast_all_hosts) {
    101                 addr48(&addr48_broadcast, mac_addr);
     101                *mac_addr = addr48_broadcast;
    102102                return EOK;
    103103        }
     
    110110
    111111        packet.opcode = aop_request;
    112         addr48(&nic->mac_addr, &packet.sender_hw_addr);
     112        packet.sender_hw_addr = nic->mac_addr;
    113113        packet.sender_proto_addr = src_addr;
    114         addr48(&addr48_broadcast, &packet.target_hw_addr);
     114        packet.target_hw_addr = addr48_broadcast;
    115115        packet.target_proto_addr = ip_addr;
    116116
     
    138138                return rc;
    139139
    140         addr48(&packet->target_hw_addr, &frame.dest);
    141         addr48(&packet->sender_hw_addr, &frame.src);
     140        frame.dest = packet->target_hw_addr;
     141        frame.src = packet->sender_hw_addr;
    142142        frame.etype_len = ETYPE_ARP;
    143143        frame.data = pdata;
  • uspace/srv/net/ethip/atrans.c

    rf05edcb rd5ed54b  
    6969
    7070        atrans->ip_addr = ip_addr;
    71         addr48(mac_addr, &atrans->mac_addr);
     71        atrans->mac_addr = *mac_addr;
    7272
    7373        fibril_mutex_lock(&atrans_list_lock);
     
    109109                return ENOENT;
    110110
    111         addr48(&atrans->mac_addr, mac_addr);
     111        *mac_addr = atrans->mac_addr;
    112112        return EOK;
    113113}
  • uspace/srv/net/ethip/ethip.c

    rf05edcb rd5ed54b  
    184184        }
    185185
    186         addr48(&nic->mac_addr, &frame.src);
     186        frame.src = nic->mac_addr;
    187187        frame.etype_len = ETYPE_IP;
    188188        frame.data = sdu->data;
     
    208208        eth_frame_t frame;
    209209
    210         addr48(&sdu->dest, &frame.dest);
    211         addr48(&nic->mac_addr, &frame.src);
     210        frame.dest = sdu->dest;
     211        frame.src = nic->mac_addr;
    212212        frame.etype_len = ETYPE_IPV6;
    213213        frame.data = sdu->data;
     
    281281
    282282        ethip_nic_t *nic = (ethip_nic_t *) srv->arg;
    283         addr48(&nic->mac_addr, mac);
     283        *mac = nic->mac_addr;
    284284
    285285        return EOK;
     
    291291
    292292        ethip_nic_t *nic = (ethip_nic_t *) srv->arg;
    293         addr48(mac, &nic->mac_addr);
     293        nic->mac_addr = *mac;
    294294
    295295        return EOK;
  • uspace/srv/net/inetsrv/inet_link.c

    rf05edcb rd5ed54b  
    401401
    402402        iplink_sdu6_t sdu6;
    403         addr48(ldest, &sdu6.dest);
     403        sdu6.dest = *ldest;
    404404
    405405        /*
  • uspace/srv/net/inetsrv/inetcfg.c

    rf05edcb rd5ed54b  
    177177        linfo->def_mtu = ilink->def_mtu;
    178178        if (ilink->mac_valid) {
    179                 addr48(&ilink->mac, &linfo->mac_addr);
     179                linfo->mac_addr = ilink->mac;
    180180        } else {
    181181                memset(&linfo->mac_addr, 0, sizeof(linfo->mac_addr));
  • uspace/srv/net/inetsrv/ndp.c

    rf05edcb rd5ed54b  
    115115
    116116                        reply.opcode = ICMPV6_NEIGHBOUR_ADVERTISEMENT;
    117                         addr48(&laddr->ilink->mac, &reply.sender_hw_addr);
     117                        reply.sender_hw_addr = laddr->ilink->mac;
    118118                        addr128(packet.target_proto_addr, reply.sender_proto_addr);
    119                         addr48(&packet.sender_hw_addr, &reply.target_hw_addr);
     119                        reply.target_hw_addr = packet.sender_hw_addr;
    120120                        addr128(packet.sender_proto_addr, reply.target_proto_addr);
    121121
     
    167167
    168168        packet.opcode = ICMPV6_NEIGHBOUR_SOLICITATION;
    169         addr48(&ilink->mac, &packet.sender_hw_addr);
     169        packet.sender_hw_addr = ilink->mac;
    170170        addr128(src_addr, packet.sender_proto_addr);
    171171        addr128(ip_addr, packet.solicited_ip);
  • uspace/srv/net/inetsrv/ntrans.c

    rf05edcb rd5ed54b  
    8383
    8484        addr128(ip_addr, ntrans->ip_addr);
    85         addr48(mac_addr, &ntrans->mac_addr);
     85        ntrans->mac_addr = *mac_addr;
    8686
    8787        fibril_mutex_lock(&ntrans_list_lock);
     
    144144
    145145        fibril_mutex_unlock(&ntrans_list_lock);
    146         addr48(&ntrans->mac_addr, mac_addr);
     146        *mac_addr = ntrans->mac_addr;
    147147        return EOK;
    148148}
Note: See TracChangeset for help on using the changeset viewer.