Lines Matching refs:addr
679 static inline bool net_ipv6_is_addr_loopback(struct in6_addr *addr) in net_ipv6_is_addr_loopback() argument
681 return UNALIGNED_GET(&addr->s6_addr32[0]) == 0 && in net_ipv6_is_addr_loopback()
682 UNALIGNED_GET(&addr->s6_addr32[1]) == 0 && in net_ipv6_is_addr_loopback()
683 UNALIGNED_GET(&addr->s6_addr32[2]) == 0 && in net_ipv6_is_addr_loopback()
684 ntohl(UNALIGNED_GET(&addr->s6_addr32[3])) == 1; in net_ipv6_is_addr_loopback()
694 static inline bool net_ipv6_is_addr_mcast(const struct in6_addr *addr) in net_ipv6_is_addr_mcast() argument
696 return addr->s6_addr[0] == 0xFF; in net_ipv6_is_addr_mcast()
702 extern struct net_if_addr *net_if_ipv6_addr_lookup(const struct in6_addr *addr,
712 static inline bool net_ipv6_is_my_addr(struct in6_addr *addr) in net_ipv6_is_my_addr() argument
714 return net_if_ipv6_addr_lookup(addr, NULL) != NULL; in net_ipv6_is_my_addr()
718 const struct in6_addr *addr, struct net_if **iface);
811 static inline bool net_ipv4_is_addr_loopback(struct in_addr *addr) in net_ipv4_is_addr_loopback() argument
813 return addr->s4_addr[0] == 127U; in net_ipv4_is_addr_loopback()
823 static inline bool net_ipv4_is_addr_unspecified(const struct in_addr *addr) in net_ipv4_is_addr_unspecified() argument
825 return UNALIGNED_GET(&addr->s_addr) == 0; in net_ipv4_is_addr_unspecified()
835 static inline bool net_ipv4_is_addr_mcast(const struct in_addr *addr) in net_ipv4_is_addr_mcast() argument
837 return (ntohl(UNALIGNED_GET(&addr->s_addr)) & 0xF0000000) == 0xE0000000; in net_ipv4_is_addr_mcast()
847 static inline bool net_ipv4_is_ll_addr(const struct in_addr *addr) in net_ipv4_is_ll_addr() argument
849 return (ntohl(UNALIGNED_GET(&addr->s_addr)) & 0xFFFF0000) == 0xA9FE0000; in net_ipv4_is_ll_addr()
861 static inline bool net_ipv4_is_private_addr(const struct in_addr *addr) in net_ipv4_is_private_addr() argument
865 masked_24 = ntohl(UNALIGNED_GET(&addr->s_addr)) & 0xFFFFFF00; in net_ipv4_is_private_addr()
980 static inline bool net_ipv6_is_ll_addr(const struct in6_addr *addr) in net_ipv6_is_ll_addr() argument
982 return UNALIGNED_GET(&addr->s6_addr16[0]) == htons(0xFE80); in net_ipv6_is_ll_addr()
992 static inline bool net_ipv6_is_sl_addr(const struct in6_addr *addr) in net_ipv6_is_sl_addr() argument
994 return UNALIGNED_GET(&addr->s6_addr16[0]) == htons(0xFEC0); in net_ipv6_is_sl_addr()
1005 static inline bool net_ipv6_is_ula_addr(const struct in6_addr *addr) in net_ipv6_is_ula_addr() argument
1007 return addr->s6_addr[0] == 0xFD; in net_ipv6_is_ula_addr()
1017 static inline bool net_ipv6_is_global_addr(const struct in6_addr *addr) in net_ipv6_is_global_addr() argument
1019 return (addr->s6_addr[0] & 0xE0) == 0x20; in net_ipv6_is_global_addr()
1031 static inline bool net_ipv6_is_private_addr(const struct in6_addr *addr) in net_ipv6_is_private_addr() argument
1035 masked_32 = ntohl(UNALIGNED_GET(&addr->s6_addr32[0])); in net_ipv6_is_private_addr()
1065 const struct in_addr *addr);
1077 const struct in_addr *addr) in net_ipv4_addr_mask_cmp() argument
1079 return net_if_ipv4_addr_mask_cmp(iface, addr); in net_ipv4_addr_mask_cmp()
1083 const struct in_addr *addr);
1095 const struct in_addr *addr) in net_ipv4_is_addr_bcast() argument
1097 if (net_ipv4_addr_cmp(addr, net_ipv4_broadcast_address())) { in net_ipv4_is_addr_bcast()
1101 return net_if_ipv4_is_addr_bcast(iface, addr); in net_ipv4_is_addr_bcast()
1105 const struct in_addr *addr) in net_ipv4_is_addr_bcast() argument
1108 ARG_UNUSED(addr); in net_ipv4_is_addr_bcast()
1114 extern struct net_if_addr *net_if_ipv4_addr_lookup(const struct in_addr *addr,
1126 static inline bool net_ipv4_is_my_addr(const struct in_addr *addr) in net_ipv4_is_my_addr() argument
1130 ret = net_if_ipv4_addr_lookup(addr, NULL) != NULL; in net_ipv4_is_my_addr()
1132 ret = net_ipv4_is_addr_bcast(NULL, addr); in net_ipv4_is_my_addr()
1145 static inline bool net_ipv6_is_addr_unspecified(const struct in6_addr *addr) in net_ipv6_is_addr_unspecified() argument
1147 return UNALIGNED_GET(&addr->s6_addr32[0]) == 0 && in net_ipv6_is_addr_unspecified()
1148 UNALIGNED_GET(&addr->s6_addr32[1]) == 0 && in net_ipv6_is_addr_unspecified()
1149 UNALIGNED_GET(&addr->s6_addr32[2]) == 0 && in net_ipv6_is_addr_unspecified()
1150 UNALIGNED_GET(&addr->s6_addr32[3]) == 0; in net_ipv6_is_addr_unspecified()
1161 static inline bool net_ipv6_is_addr_solicited_node(const struct in6_addr *addr) in net_ipv6_is_addr_solicited_node() argument
1163 return UNALIGNED_GET(&addr->s6_addr32[0]) == htonl(0xff020000) && in net_ipv6_is_addr_solicited_node()
1164 UNALIGNED_GET(&addr->s6_addr32[1]) == 0x00000000 && in net_ipv6_is_addr_solicited_node()
1165 UNALIGNED_GET(&addr->s6_addr32[2]) == htonl(0x00000001) && in net_ipv6_is_addr_solicited_node()
1166 ((UNALIGNED_GET(&addr->s6_addr32[3]) & htonl(0xff000000)) == in net_ipv6_is_addr_solicited_node()
1180 static inline bool net_ipv6_is_addr_mcast_scope(const struct in6_addr *addr, in net_ipv6_is_addr_mcast_scope() argument
1183 return (addr->s6_addr[0] == 0xff) && ((addr->s6_addr[1] & 0xF) == scope); in net_ipv6_is_addr_mcast_scope()
1209 static inline bool net_ipv6_is_addr_mcast_global(const struct in6_addr *addr) in net_ipv6_is_addr_mcast_global() argument
1211 return net_ipv6_is_addr_mcast_scope(addr, 0x0e); in net_ipv6_is_addr_mcast_global()
1223 static inline bool net_ipv6_is_addr_mcast_iface(const struct in6_addr *addr) in net_ipv6_is_addr_mcast_iface() argument
1225 return net_ipv6_is_addr_mcast_scope(addr, 0x01); in net_ipv6_is_addr_mcast_iface()
1237 static inline bool net_ipv6_is_addr_mcast_link(const struct in6_addr *addr) in net_ipv6_is_addr_mcast_link() argument
1239 return net_ipv6_is_addr_mcast_scope(addr, 0x02); in net_ipv6_is_addr_mcast_link()
1251 static inline bool net_ipv6_is_addr_mcast_mesh(const struct in6_addr *addr) in net_ipv6_is_addr_mcast_mesh() argument
1253 return net_ipv6_is_addr_mcast_scope(addr, 0x03); in net_ipv6_is_addr_mcast_mesh()
1265 static inline bool net_ipv6_is_addr_mcast_site(const struct in6_addr *addr) in net_ipv6_is_addr_mcast_site() argument
1267 return net_ipv6_is_addr_mcast_scope(addr, 0x05); in net_ipv6_is_addr_mcast_site()
1279 static inline bool net_ipv6_is_addr_mcast_org(const struct in6_addr *addr) in net_ipv6_is_addr_mcast_org() argument
1281 return net_ipv6_is_addr_mcast_scope(addr, 0x08); in net_ipv6_is_addr_mcast_org()
1294 static inline bool net_ipv6_is_addr_mcast_group(const struct in6_addr *addr, in net_ipv6_is_addr_mcast_group() argument
1297 return UNALIGNED_GET(&addr->s6_addr16[1]) == group->s6_addr16[1] && in net_ipv6_is_addr_mcast_group()
1298 UNALIGNED_GET(&addr->s6_addr16[2]) == group->s6_addr16[2] && in net_ipv6_is_addr_mcast_group()
1299 UNALIGNED_GET(&addr->s6_addr16[3]) == group->s6_addr16[3] && in net_ipv6_is_addr_mcast_group()
1300 UNALIGNED_GET(&addr->s6_addr32[1]) == group->s6_addr32[1] && in net_ipv6_is_addr_mcast_group()
1301 UNALIGNED_GET(&addr->s6_addr32[2]) == group->s6_addr32[1] && in net_ipv6_is_addr_mcast_group()
1302 UNALIGNED_GET(&addr->s6_addr32[3]) == group->s6_addr32[3]; in net_ipv6_is_addr_mcast_group()
1314 net_ipv6_is_addr_mcast_all_nodes_group(const struct in6_addr *addr) in net_ipv6_is_addr_mcast_all_nodes_group() argument
1321 return net_ipv6_is_addr_mcast_group(addr, &all_nodes_mcast_group); in net_ipv6_is_addr_mcast_all_nodes_group()
1334 net_ipv6_is_addr_mcast_iface_all_nodes(const struct in6_addr *addr) in net_ipv6_is_addr_mcast_iface_all_nodes() argument
1336 return net_ipv6_is_addr_mcast_iface(addr) && in net_ipv6_is_addr_mcast_iface_all_nodes()
1337 net_ipv6_is_addr_mcast_all_nodes_group(addr); in net_ipv6_is_addr_mcast_iface_all_nodes()
1350 net_ipv6_is_addr_mcast_link_all_nodes(const struct in6_addr *addr) in net_ipv6_is_addr_mcast_link_all_nodes() argument
1352 return net_ipv6_is_addr_mcast_link(addr) && in net_ipv6_is_addr_mcast_link_all_nodes()
1353 net_ipv6_is_addr_mcast_all_nodes_group(addr); in net_ipv6_is_addr_mcast_link_all_nodes()
1392 static inline void net_ipv6_addr_create(struct in6_addr *addr, in net_ipv6_addr_create() argument
1398 UNALIGNED_PUT(htons(addr0), &addr->s6_addr16[0]); in net_ipv6_addr_create()
1399 UNALIGNED_PUT(htons(addr1), &addr->s6_addr16[1]); in net_ipv6_addr_create()
1400 UNALIGNED_PUT(htons(addr2), &addr->s6_addr16[2]); in net_ipv6_addr_create()
1401 UNALIGNED_PUT(htons(addr3), &addr->s6_addr16[3]); in net_ipv6_addr_create()
1402 UNALIGNED_PUT(htons(addr4), &addr->s6_addr16[4]); in net_ipv6_addr_create()
1403 UNALIGNED_PUT(htons(addr5), &addr->s6_addr16[5]); in net_ipv6_addr_create()
1404 UNALIGNED_PUT(htons(addr6), &addr->s6_addr16[6]); in net_ipv6_addr_create()
1405 UNALIGNED_PUT(htons(addr7), &addr->s6_addr16[7]); in net_ipv6_addr_create()
1413 static inline void net_ipv6_addr_create_ll_allnodes_mcast(struct in6_addr *addr) in net_ipv6_addr_create_ll_allnodes_mcast() argument
1415 net_ipv6_addr_create(addr, 0xff02, 0, 0, 0, 0, 0, 0, 0x0001); in net_ipv6_addr_create_ll_allnodes_mcast()
1423 static inline void net_ipv6_addr_create_ll_allrouters_mcast(struct in6_addr *addr) in net_ipv6_addr_create_ll_allrouters_mcast() argument
1425 net_ipv6_addr_create(addr, 0xff02, 0, 0, 0, 0, 0, 0, 0x0002); in net_ipv6_addr_create_ll_allrouters_mcast()
1450 static inline bool net_ipv6_addr_is_v4_mapped(const struct in6_addr *addr) in net_ipv6_addr_is_v4_mapped() argument
1452 if (UNALIGNED_GET(&addr->s6_addr32[0]) == 0 && in net_ipv6_addr_is_v4_mapped()
1453 UNALIGNED_GET(&addr->s6_addr32[1]) == 0 && in net_ipv6_addr_is_v4_mapped()
1454 UNALIGNED_GET(&addr->s6_addr16[5]) == 0xffff) { in net_ipv6_addr_is_v4_mapped()
1483 struct in6_addr *addr,
1492 static inline void net_ipv6_addr_create_iid(struct in6_addr *addr, in net_ipv6_addr_create_iid() argument
1495 (void)net_ipv6_addr_generate_iid(NULL, NULL, NULL, 0, 0, addr, lladdr); in net_ipv6_addr_create_iid()
1503 static inline bool net_ipv6_addr_based_on_ll(const struct in6_addr *addr, in net_ipv6_addr_based_on_ll() argument
1506 if (!addr || !lladdr) { in net_ipv6_addr_based_on_ll()
1512 if (!memcmp(&addr->s6_addr[14], lladdr->addr, lladdr->len) && in net_ipv6_addr_based_on_ll()
1513 addr->s6_addr[8] == 0U && in net_ipv6_addr_based_on_ll()
1514 addr->s6_addr[9] == 0U && in net_ipv6_addr_based_on_ll()
1515 addr->s6_addr[10] == 0U && in net_ipv6_addr_based_on_ll()
1516 addr->s6_addr[11] == 0xff && in net_ipv6_addr_based_on_ll()
1517 addr->s6_addr[12] == 0xfe) { in net_ipv6_addr_based_on_ll()
1524 if (!memcmp(&addr->s6_addr[9], &lladdr->addr[1], 2) && in net_ipv6_addr_based_on_ll()
1525 !memcmp(&addr->s6_addr[13], &lladdr->addr[3], 3) && in net_ipv6_addr_based_on_ll()
1526 addr->s6_addr[11] == 0xff && in net_ipv6_addr_based_on_ll()
1527 addr->s6_addr[12] == 0xfe && in net_ipv6_addr_based_on_ll()
1528 (addr->s6_addr[8] ^ 0x02) == lladdr->addr[0]) { in net_ipv6_addr_based_on_ll()
1535 if (!memcmp(&addr->s6_addr[9], &lladdr->addr[1], in net_ipv6_addr_based_on_ll()
1537 (addr->s6_addr[8] ^ 0x02) == lladdr->addr[0]) { in net_ipv6_addr_based_on_ll()
1555 static inline struct sockaddr_in6 *net_sin6(const struct sockaddr *addr) in net_sin6() argument
1557 return (struct sockaddr_in6 *)addr; in net_sin6()
1568 static inline struct sockaddr_in *net_sin(const struct sockaddr *addr) in net_sin() argument
1570 return (struct sockaddr_in *)addr; in net_sin()
1582 struct sockaddr_in6_ptr *net_sin6_ptr(const struct sockaddr_ptr *addr) in net_sin6_ptr() argument
1584 return (struct sockaddr_in6_ptr *)addr; in net_sin6_ptr()
1596 struct sockaddr_in_ptr *net_sin_ptr(const struct sockaddr_ptr *addr) in net_sin_ptr() argument
1598 return (struct sockaddr_in_ptr *)addr; in net_sin_ptr()
1610 struct sockaddr_ll_ptr *net_sll_ptr(const struct sockaddr_ptr *addr) in net_sll_ptr() argument
1612 return (struct sockaddr_ll_ptr *)addr; in net_sll_ptr()
1624 struct sockaddr_can_ptr *net_can_ptr(const struct sockaddr_ptr *addr) in net_can_ptr() argument
1626 return (struct sockaddr_can_ptr *)addr; in net_can_ptr()
1680 struct sockaddr *addr);
1691 int net_port_set_default(struct sockaddr *addr, uint16_t default_port);
1821 int net_ipv6_pe_add_filter(struct in6_addr *addr, bool is_denylist);
1823 static inline int net_ipv6_pe_add_filter(struct in6_addr *addr, in net_ipv6_pe_add_filter() argument
1826 ARG_UNUSED(addr); in net_ipv6_pe_add_filter()
1841 int net_ipv6_pe_del_filter(struct in6_addr *addr);
1843 static inline int net_ipv6_pe_del_filter(struct in6_addr *addr) in net_ipv6_pe_del_filter() argument
1845 ARG_UNUSED(addr); in net_ipv6_pe_del_filter()