Changeset 8a9a41e in mainline for uspace/lib/inet/src/addr.c


Ignore:
Timestamp:
2021-10-24T08:28:43Z (3 years ago)
Author:
GitHub <noreply@…>
Children:
6855743
Parents:
2ce943a (diff), cd981f2a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Erik Kučák <35500848+Riko196@…> (2021-10-24 08:28:43)
git-committer:
GitHub <noreply@…> (2021-10-24 08:28:43)
Message:

Merge branch 'HelenOS:master' into master

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/inet/src/addr.c

    r2ce943a r8a9a41e  
    11/*
    2  * Copyright (c) 2013 Jiri Svoboda
     2 * Copyright (c) 2021 Jiri Svoboda
    33 * Copyright (c) 2013 Martin Decky
    44 * All rights reserved.
     
    2828 */
    2929
    30 /** @addtogroup libc
     30/** @addtogroup libinet
    3131 * @{
    3232 */
     
    3737#include <errno.h>
    3838#include <inet/addr.h>
     39#include <inet/eth_addr.h>
    3940#include <stdio.h>
    4041#include <stddef.h>
     
    5455const addr32_t addr32_broadcast_all_hosts = 0xffffffff;
    5556
    56 const addr48_t addr48_broadcast = {
    57         0xff, 0xff, 0xff, 0xff, 0xff, 0xff
    58 };
    59 
    60 static const addr48_t inet_addr48_solicited_node = {
    61         0x33, 0x33, 0xff, 0, 0, 0
    62 };
     57static eth_addr_t inet_eth_addr_solicited_node =
     58    ETH_ADDR_INITIALIZER(0x33, 0x33, 0xff, 0, 0, 0);
    6359
    6460static const inet_addr_t inet_addr_any_addr = {
     
    7268};
    7369
    74 void addr48(const addr48_t src, addr48_t dst)
    75 {
    76         memcpy(dst, src, 6);
    77 }
    78 
    7970void addr128(const addr128_t src, addr128_t dst)
    8071{
    8172        memcpy(dst, src, 16);
    82 }
    83 
    84 /** Compare addr48.
    85  *
    86  * @return Non-zero if equal, zero if not equal.
    87  */
    88 int addr48_compare(const addr48_t a, const addr48_t b)
    89 {
    90         return memcmp(a, b, 6) == 0;
    9173}
    9274
     
    10688 *
    10789 */
    108 void addr48_solicited_node(const addr128_t ip, addr48_t mac)
    109 {
    110         memcpy(mac, inet_addr48_solicited_node, 3);
    111         memcpy(mac + 3, ip + 13, 3);
     90void eth_addr_solicited_node(const addr128_t ip, eth_addr_t *mac)
     91{
     92        uint8_t b[6];
     93        mac->a = inet_eth_addr_solicited_node.a;
     94
     95        eth_addr_encode(&inet_eth_addr_solicited_node, b);
     96        memcpy(&b[3], ip + 13, 3);
     97        eth_addr_decode(b, mac);
    11298}
    11399
Note: See TracChangeset for help on using the changeset viewer.