Lines Matching refs:addr

598 static inline bool net_ipv6_is_addr_loopback(struct in6_addr *addr)  in net_ipv6_is_addr_loopback()  argument
600 return UNALIGNED_GET(&addr->s6_addr32[0]) == 0 && in net_ipv6_is_addr_loopback()
601 UNALIGNED_GET(&addr->s6_addr32[1]) == 0 && in net_ipv6_is_addr_loopback()
602 UNALIGNED_GET(&addr->s6_addr32[2]) == 0 && in net_ipv6_is_addr_loopback()
603 ntohl(UNALIGNED_GET(&addr->s6_addr32[3])) == 1; in net_ipv6_is_addr_loopback()
613 static inline bool net_ipv6_is_addr_mcast(const struct in6_addr *addr) in net_ipv6_is_addr_mcast() argument
615 return addr->s6_addr[0] == 0xFF; in net_ipv6_is_addr_mcast()
621 extern struct net_if_addr *net_if_ipv6_addr_lookup(const struct in6_addr *addr,
631 static inline bool net_ipv6_is_my_addr(struct in6_addr *addr) in net_ipv6_is_my_addr() argument
633 return net_if_ipv6_addr_lookup(addr, NULL) != NULL; in net_ipv6_is_my_addr()
637 const struct in6_addr *addr, struct net_if **iface);
698 static inline bool net_ipv4_is_addr_loopback(struct in_addr *addr) in net_ipv4_is_addr_loopback() argument
700 return addr->s4_addr[0] == 127U; in net_ipv4_is_addr_loopback()
710 static inline bool net_ipv4_is_addr_unspecified(const struct in_addr *addr) in net_ipv4_is_addr_unspecified() argument
712 return UNALIGNED_GET(&addr->s_addr) == 0; in net_ipv4_is_addr_unspecified()
722 static inline bool net_ipv4_is_addr_mcast(const struct in_addr *addr) in net_ipv4_is_addr_mcast() argument
724 return (ntohl(UNALIGNED_GET(&addr->s_addr)) & 0xF0000000) == 0xE0000000; in net_ipv4_is_addr_mcast()
734 static inline bool net_ipv4_is_ll_addr(const struct in_addr *addr) in net_ipv4_is_ll_addr() argument
736 return (ntohl(UNALIGNED_GET(&addr->s_addr)) & 0xFFFF0000) == 0xA9FE0000; in net_ipv4_is_ll_addr()
839 static inline bool net_ipv6_is_ll_addr(const struct in6_addr *addr) in net_ipv6_is_ll_addr() argument
841 return UNALIGNED_GET(&addr->s6_addr16[0]) == htons(0xFE80); in net_ipv6_is_ll_addr()
851 static inline bool net_ipv6_is_ula_addr(const struct in6_addr *addr) in net_ipv6_is_ula_addr() argument
853 return addr->s6_addr[0] == 0xFD; in net_ipv6_is_ula_addr()
879 const struct in_addr *addr);
891 const struct in_addr *addr) in net_ipv4_addr_mask_cmp() argument
893 return net_if_ipv4_addr_mask_cmp(iface, addr); in net_ipv4_addr_mask_cmp()
897 const struct in_addr *addr);
909 const struct in_addr *addr) in net_ipv4_is_addr_bcast() argument
911 if (net_ipv4_addr_cmp(addr, net_ipv4_broadcast_address())) { in net_ipv4_is_addr_bcast()
915 return net_if_ipv4_is_addr_bcast(iface, addr); in net_ipv4_is_addr_bcast()
919 const struct in_addr *addr) in net_ipv4_is_addr_bcast() argument
922 ARG_UNUSED(addr); in net_ipv4_is_addr_bcast()
928 extern struct net_if_addr *net_if_ipv4_addr_lookup(const struct in_addr *addr,
940 static inline bool net_ipv4_is_my_addr(const struct in_addr *addr) in net_ipv4_is_my_addr() argument
944 ret = net_if_ipv4_addr_lookup(addr, NULL) != NULL; in net_ipv4_is_my_addr()
946 ret = net_ipv4_is_addr_bcast(NULL, addr); in net_ipv4_is_my_addr()
959 static inline bool net_ipv6_is_addr_unspecified(const struct in6_addr *addr) in net_ipv6_is_addr_unspecified() argument
961 return UNALIGNED_GET(&addr->s6_addr32[0]) == 0 && in net_ipv6_is_addr_unspecified()
962 UNALIGNED_GET(&addr->s6_addr32[1]) == 0 && in net_ipv6_is_addr_unspecified()
963 UNALIGNED_GET(&addr->s6_addr32[2]) == 0 && in net_ipv6_is_addr_unspecified()
964 UNALIGNED_GET(&addr->s6_addr32[3]) == 0; in net_ipv6_is_addr_unspecified()
975 static inline bool net_ipv6_is_addr_solicited_node(const struct in6_addr *addr) in net_ipv6_is_addr_solicited_node() argument
977 return UNALIGNED_GET(&addr->s6_addr32[0]) == htonl(0xff020000) && in net_ipv6_is_addr_solicited_node()
978 UNALIGNED_GET(&addr->s6_addr32[1]) == 0x00000000 && in net_ipv6_is_addr_solicited_node()
979 UNALIGNED_GET(&addr->s6_addr32[2]) == htonl(0x00000001) && in net_ipv6_is_addr_solicited_node()
980 ((UNALIGNED_GET(&addr->s6_addr32[3]) & htonl(0xff000000)) == in net_ipv6_is_addr_solicited_node()
994 static inline bool net_ipv6_is_addr_mcast_scope(const struct in6_addr *addr, in net_ipv6_is_addr_mcast_scope() argument
997 return (addr->s6_addr[0] == 0xff) && (addr->s6_addr[1] == scope); in net_ipv6_is_addr_mcast_scope()
1023 static inline bool net_ipv6_is_addr_mcast_global(const struct in6_addr *addr) in net_ipv6_is_addr_mcast_global() argument
1025 return net_ipv6_is_addr_mcast_scope(addr, 0x0e); in net_ipv6_is_addr_mcast_global()
1037 static inline bool net_ipv6_is_addr_mcast_iface(const struct in6_addr *addr) in net_ipv6_is_addr_mcast_iface() argument
1039 return net_ipv6_is_addr_mcast_scope(addr, 0x01); in net_ipv6_is_addr_mcast_iface()
1051 static inline bool net_ipv6_is_addr_mcast_link(const struct in6_addr *addr) in net_ipv6_is_addr_mcast_link() argument
1053 return net_ipv6_is_addr_mcast_scope(addr, 0x02); in net_ipv6_is_addr_mcast_link()
1065 static inline bool net_ipv6_is_addr_mcast_mesh(const struct in6_addr *addr) in net_ipv6_is_addr_mcast_mesh() argument
1067 return net_ipv6_is_addr_mcast_scope(addr, 0x03); in net_ipv6_is_addr_mcast_mesh()
1079 static inline bool net_ipv6_is_addr_mcast_site(const struct in6_addr *addr) in net_ipv6_is_addr_mcast_site() argument
1081 return net_ipv6_is_addr_mcast_scope(addr, 0x05); in net_ipv6_is_addr_mcast_site()
1093 static inline bool net_ipv6_is_addr_mcast_org(const struct in6_addr *addr) in net_ipv6_is_addr_mcast_org() argument
1095 return net_ipv6_is_addr_mcast_scope(addr, 0x08); in net_ipv6_is_addr_mcast_org()
1108 static inline bool net_ipv6_is_addr_mcast_group(const struct in6_addr *addr, in net_ipv6_is_addr_mcast_group() argument
1111 return UNALIGNED_GET(&addr->s6_addr16[1]) == group->s6_addr16[1] && in net_ipv6_is_addr_mcast_group()
1112 UNALIGNED_GET(&addr->s6_addr16[2]) == group->s6_addr16[2] && in net_ipv6_is_addr_mcast_group()
1113 UNALIGNED_GET(&addr->s6_addr16[3]) == group->s6_addr16[3] && in net_ipv6_is_addr_mcast_group()
1114 UNALIGNED_GET(&addr->s6_addr32[1]) == group->s6_addr32[1] && in net_ipv6_is_addr_mcast_group()
1115 UNALIGNED_GET(&addr->s6_addr32[2]) == group->s6_addr32[1] && in net_ipv6_is_addr_mcast_group()
1116 UNALIGNED_GET(&addr->s6_addr32[3]) == group->s6_addr32[3]; in net_ipv6_is_addr_mcast_group()
1128 net_ipv6_is_addr_mcast_all_nodes_group(const struct in6_addr *addr) in net_ipv6_is_addr_mcast_all_nodes_group() argument
1135 return net_ipv6_is_addr_mcast_group(addr, &all_nodes_mcast_group); in net_ipv6_is_addr_mcast_all_nodes_group()
1148 net_ipv6_is_addr_mcast_iface_all_nodes(const struct in6_addr *addr) in net_ipv6_is_addr_mcast_iface_all_nodes() argument
1150 return net_ipv6_is_addr_mcast_iface(addr) && in net_ipv6_is_addr_mcast_iface_all_nodes()
1151 net_ipv6_is_addr_mcast_all_nodes_group(addr); in net_ipv6_is_addr_mcast_iface_all_nodes()
1164 net_ipv6_is_addr_mcast_link_all_nodes(const struct in6_addr *addr) in net_ipv6_is_addr_mcast_link_all_nodes() argument
1166 return net_ipv6_is_addr_mcast_link(addr) && in net_ipv6_is_addr_mcast_link_all_nodes()
1167 net_ipv6_is_addr_mcast_all_nodes_group(addr); in net_ipv6_is_addr_mcast_link_all_nodes()
1206 static inline void net_ipv6_addr_create(struct in6_addr *addr, in net_ipv6_addr_create() argument
1212 UNALIGNED_PUT(htons(addr0), &addr->s6_addr16[0]); in net_ipv6_addr_create()
1213 UNALIGNED_PUT(htons(addr1), &addr->s6_addr16[1]); in net_ipv6_addr_create()
1214 UNALIGNED_PUT(htons(addr2), &addr->s6_addr16[2]); in net_ipv6_addr_create()
1215 UNALIGNED_PUT(htons(addr3), &addr->s6_addr16[3]); in net_ipv6_addr_create()
1216 UNALIGNED_PUT(htons(addr4), &addr->s6_addr16[4]); in net_ipv6_addr_create()
1217 UNALIGNED_PUT(htons(addr5), &addr->s6_addr16[5]); in net_ipv6_addr_create()
1218 UNALIGNED_PUT(htons(addr6), &addr->s6_addr16[6]); in net_ipv6_addr_create()
1219 UNALIGNED_PUT(htons(addr7), &addr->s6_addr16[7]); in net_ipv6_addr_create()
1227 static inline void net_ipv6_addr_create_ll_allnodes_mcast(struct in6_addr *addr) in net_ipv6_addr_create_ll_allnodes_mcast() argument
1229 net_ipv6_addr_create(addr, 0xff02, 0, 0, 0, 0, 0, 0, 0x0001); in net_ipv6_addr_create_ll_allnodes_mcast()
1237 static inline void net_ipv6_addr_create_ll_allrouters_mcast(struct in6_addr *addr) in net_ipv6_addr_create_ll_allrouters_mcast() argument
1239 net_ipv6_addr_create(addr, 0xff02, 0, 0, 0, 0, 0, 0, 0x0002); in net_ipv6_addr_create_ll_allrouters_mcast()
1248 static inline void net_ipv6_addr_create_iid(struct in6_addr *addr, in net_ipv6_addr_create_iid() argument
1251 UNALIGNED_PUT(htonl(0xfe800000), &addr->s6_addr32[0]); in net_ipv6_addr_create_iid()
1252 UNALIGNED_PUT(0, &addr->s6_addr32[1]); in net_ipv6_addr_create_iid()
1260 UNALIGNED_PUT(0, &addr->s6_addr32[2]); in net_ipv6_addr_create_iid()
1261 addr->s6_addr[11] = 0xff; in net_ipv6_addr_create_iid()
1262 addr->s6_addr[12] = 0xfe; in net_ipv6_addr_create_iid()
1263 addr->s6_addr[13] = 0U; in net_ipv6_addr_create_iid()
1264 addr->s6_addr[14] = lladdr->addr[0]; in net_ipv6_addr_create_iid()
1265 addr->s6_addr[15] = lladdr->addr[1]; in net_ipv6_addr_create_iid()
1273 memcpy(&addr->s6_addr[8], lladdr->addr, 3); in net_ipv6_addr_create_iid()
1274 addr->s6_addr[11] = 0xff; in net_ipv6_addr_create_iid()
1275 addr->s6_addr[12] = 0xfe; in net_ipv6_addr_create_iid()
1276 memcpy(&addr->s6_addr[13], lladdr->addr + 3, 3); in net_ipv6_addr_create_iid()
1283 addr->s6_addr[8] ^= 0x02; in net_ipv6_addr_create_iid()
1288 addr->s6_addr[8] ^= 0x02; in net_ipv6_addr_create_iid()
1293 memcpy(&addr->s6_addr[8], lladdr->addr, lladdr->len); in net_ipv6_addr_create_iid()
1294 addr->s6_addr[8] ^= 0x02; in net_ipv6_addr_create_iid()
1304 static inline bool net_ipv6_addr_based_on_ll(const struct in6_addr *addr, in net_ipv6_addr_based_on_ll() argument
1307 if (!addr || !lladdr) { in net_ipv6_addr_based_on_ll()
1313 if (!memcmp(&addr->s6_addr[14], lladdr->addr, lladdr->len) && in net_ipv6_addr_based_on_ll()
1314 addr->s6_addr[8] == 0U && in net_ipv6_addr_based_on_ll()
1315 addr->s6_addr[9] == 0U && in net_ipv6_addr_based_on_ll()
1316 addr->s6_addr[10] == 0U && in net_ipv6_addr_based_on_ll()
1317 addr->s6_addr[11] == 0xff && in net_ipv6_addr_based_on_ll()
1318 addr->s6_addr[12] == 0xfe) { in net_ipv6_addr_based_on_ll()
1325 if (!memcmp(&addr->s6_addr[9], &lladdr->addr[1], 2) && in net_ipv6_addr_based_on_ll()
1326 !memcmp(&addr->s6_addr[13], &lladdr->addr[3], 3) && in net_ipv6_addr_based_on_ll()
1327 addr->s6_addr[11] == 0xff && in net_ipv6_addr_based_on_ll()
1328 addr->s6_addr[12] == 0xfe && in net_ipv6_addr_based_on_ll()
1329 (addr->s6_addr[8] ^ 0x02) == lladdr->addr[0]) { in net_ipv6_addr_based_on_ll()
1333 if (!memcmp(&addr->s6_addr[9], &lladdr->addr[1], 2) && in net_ipv6_addr_based_on_ll()
1334 !memcmp(&addr->s6_addr[13], &lladdr->addr[3], 3) && in net_ipv6_addr_based_on_ll()
1335 addr->s6_addr[11] == 0xff && in net_ipv6_addr_based_on_ll()
1336 addr->s6_addr[12] == 0xfe in net_ipv6_addr_based_on_ll()
1341 && (addr->s6_addr[8] ^ 0x02) == lladdr->addr[0] in net_ipv6_addr_based_on_ll()
1350 if (!memcmp(&addr->s6_addr[9], &lladdr->addr[1], in net_ipv6_addr_based_on_ll()
1352 (addr->s6_addr[8] ^ 0x02) == lladdr->addr[0]) { in net_ipv6_addr_based_on_ll()
1370 static inline struct sockaddr_in6 *net_sin6(const struct sockaddr *addr) in net_sin6() argument
1372 return (struct sockaddr_in6 *)addr; in net_sin6()
1383 static inline struct sockaddr_in *net_sin(const struct sockaddr *addr) in net_sin() argument
1385 return (struct sockaddr_in *)addr; in net_sin()
1397 struct sockaddr_in6_ptr *net_sin6_ptr(const struct sockaddr_ptr *addr) in net_sin6_ptr() argument
1399 return (struct sockaddr_in6_ptr *)addr; in net_sin6_ptr()
1411 struct sockaddr_in_ptr *net_sin_ptr(const struct sockaddr_ptr *addr) in net_sin_ptr() argument
1413 return (struct sockaddr_in_ptr *)addr; in net_sin_ptr()
1425 struct sockaddr_ll_ptr *net_sll_ptr(const struct sockaddr_ptr *addr) in net_sll_ptr() argument
1427 return (struct sockaddr_ll_ptr *)addr; in net_sll_ptr()
1439 struct sockaddr_can_ptr *net_can_ptr(const struct sockaddr_ptr *addr) in net_can_ptr() argument
1441 return (struct sockaddr_can_ptr *)addr; in net_can_ptr()
1495 struct sockaddr *addr);