Changeset 83781a22 in mainline for uspace/lib/c/generic/inet/addr.c


Ignore:
Timestamp:
2013-07-25T13:20:03Z (12 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ccdc63e
Parents:
b323a3a
Message:

setup NIC multicast address filter based on the configured IPv6 addresses
(multicast functionality is required for NDP)

File:
1 edited

Legend:

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

    rb323a3a r83781a22  
    5252};
    5353
     54static const addr48_t inet_addr48_solicited_node = {
     55        0x33, 0x33, 0xff, 0, 0, 0
     56};
     57
    5458static const inet_addr_t inet_addr_any_addr = {
    5559        .family = AF_INET,
     
    7276}
    7377
     78int addr48_compare(const addr48_t a, const addr48_t b)
     79{
     80        return memcmp(a, b, 6);
     81}
     82
    7483int addr128_compare(const addr128_t a, const addr128_t b)
    7584{
    7685        return memcmp(a, b, 16);
     86}
     87
     88/** Compute solicited node MAC multicast address from target IPv6 address
     89 *
     90 * @param ip  Target IPv6 address
     91 * @param mac Solicited MAC address to be assigned
     92 *
     93 */
     94void addr48_solicited_node(const addr128_t ip, addr48_t mac)
     95{
     96        memcpy(mac, inet_addr48_solicited_node, 3);
     97        memcpy(mac + 3, ip + 13, 3);
    7798}
    7899
Note: See TracChangeset for help on using the changeset viewer.