Lines Matching refs:addr
27 struct mptcp_addr_info addr; member
35 struct mptcp_addr_info addr; member
69 addr_equals = a->addr.s_addr == b->addr.s_addr; in addresses_equal()
75 addr_equals = a->addr.s_addr == b->addr6.s6_addr32[3]; in addresses_equal()
78 addr_equals = a->addr6.s6_addr32[3] == b->addr.s_addr; in addresses_equal()
90 static bool address_zero(const struct mptcp_addr_info *addr) in address_zero() argument
95 zero.family = addr->family; in address_zero()
97 return addresses_equal(addr, &zero, true); in address_zero()
101 struct mptcp_addr_info *addr) in local_address() argument
103 addr->family = skc->skc_family; in local_address()
104 addr->port = htons(skc->skc_num); in local_address()
105 if (addr->family == AF_INET) in local_address()
106 addr->addr.s_addr = skc->skc_rcv_saddr; in local_address()
108 else if (addr->family == AF_INET6) in local_address()
109 addr->addr6 = skc->skc_v6_rcv_saddr; in local_address()
114 struct mptcp_addr_info *addr) in remote_address() argument
116 addr->family = skc->skc_family; in remote_address()
117 addr->port = skc->skc_dport; in remote_address()
118 if (addr->family == AF_INET) in remote_address()
119 addr->addr.s_addr = skc->skc_daddr; in remote_address()
121 else if (addr->family == AF_INET6) in remote_address()
122 addr->addr6 = skc->skc_v6_daddr; in remote_address()
177 if (entry->addr.family != sk->sk_family) { in select_local_address()
179 if ((entry->addr.family == AF_INET && in select_local_address()
182 !ipv6_addr_v4mapped(&entry->addr.addr6))) in select_local_address()
190 if (!lookup_subflow_by_saddr(&msk->conn_list, &entry->addr)) { in select_local_address()
269 struct mptcp_addr_info *addr) in mptcp_lookup_anno_list_by_saddr() argument
276 if (addresses_equal(&entry->addr, addr, true)) in mptcp_lookup_anno_list_by_saddr()
293 if (addresses_equal(&entry->addr, &saddr, true)) { in mptcp_pm_sport_in_anno_list()
318 if (!entry->addr.id) in mptcp_pm_add_timer()
329 pr_debug("retransmit ADD_ADDR id=%d", entry->addr.id); in mptcp_pm_add_timer()
330 mptcp_pm_announce_addr(msk, &entry->addr, false); in mptcp_pm_add_timer()
350 struct mptcp_addr_info *addr, bool check_id) in mptcp_pm_del_add_timer() argument
356 entry = mptcp_lookup_anno_list_by_saddr(msk, addr); in mptcp_pm_del_add_timer()
357 if (entry && (!check_id || entry->addr.id == addr->id)) in mptcp_pm_del_add_timer()
361 if (entry && (!check_id || entry->addr.id == addr->id)) in mptcp_pm_del_add_timer()
376 if (mptcp_lookup_anno_list_by_saddr(msk, &entry->addr)) in mptcp_pm_alloc_anno_list()
385 add_entry->addr = entry->addr; in mptcp_pm_alloc_anno_list()
415 struct mptcp_addr_info *addr) in lookup_address_in_vec()
420 if (addresses_equal(&addrs[i], addr, addr->port)) in lookup_address_in_vec()
469 if (addresses_equal(&entry->addr, info, true)) in __lookup_addr()
503 mptcp_pm_announce_addr(msk, &local->addr, false); in mptcp_pm_create_subflow_or_signal_addr()
529 __mptcp_subflow_connect(sk, &local->addr, &addrs[i]); in mptcp_pm_create_subflow_or_signal_addr()
572 if (entry->addr.family != sk->sk_family) { in fill_local_addresses_vec()
574 if ((entry->addr.family == AF_INET && in fill_local_addresses_vec()
577 !ipv6_addr_v4mapped(&entry->addr.addr6))) in fill_local_addresses_vec()
584 addrs[i++] = entry->addr; in fill_local_addresses_vec()
680 struct mptcp_addr_info *addr, in mptcp_pm_nl_mp_prio_send_ack() argument
693 if (!addresses_equal(&local, addr, addr->port)) in mptcp_pm_nl_mp_prio_send_ack()
841 if (test_bit(entry->addr.id, pernet->id_bitmap)) in mptcp_pm_nl_append_new_local_addr()
848 if (addresses_equal(&cur->addr, &entry->addr, in mptcp_pm_nl_append_new_local_addr()
854 if (!entry->addr.id && needs_id) { in mptcp_pm_nl_append_new_local_addr()
856 entry->addr.id = find_next_zero_bit(pernet->id_bitmap, in mptcp_pm_nl_append_new_local_addr()
859 if (!entry->addr.id && pernet->next_id != 1) { in mptcp_pm_nl_append_new_local_addr()
865 if (!entry->addr.id && needs_id) in mptcp_pm_nl_append_new_local_addr()
868 __set_bit(entry->addr.id, pernet->id_bitmap); in mptcp_pm_nl_append_new_local_addr()
869 if (entry->addr.id > pernet->next_id) in mptcp_pm_nl_append_new_local_addr()
870 pernet->next_id = entry->addr.id; in mptcp_pm_nl_append_new_local_addr()
883 ret = entry->addr.id; in mptcp_pm_nl_append_new_local_addr()
898 struct sockaddr_storage addr; in mptcp_pm_nl_create_listen_socket() local
904 err = sock_create_kern(sock_net(sk), entry->addr.family, in mptcp_pm_nl_create_listen_socket()
935 mptcp_info2sockaddr(&entry->addr, &addr, entry->addr.family); in mptcp_pm_nl_create_listen_socket()
937 if (entry->addr.family == AF_INET6) in mptcp_pm_nl_create_listen_socket()
940 err = kernel_bind(ssock, (struct sockaddr *)&addr, addrlen); in mptcp_pm_nl_create_listen_socket()
985 if (addresses_equal(&entry->addr, &skc_local, entry->addr.port)) { in mptcp_pm_nl_get_local_id()
986 ret = entry->addr.id; in mptcp_pm_nl_get_local_id()
999 entry->addr = skc_local; in mptcp_pm_nl_get_local_id()
1000 entry->addr.id = 0; in mptcp_pm_nl_get_local_id()
1001 entry->addr.port = 0; in mptcp_pm_nl_get_local_id()
1127 entry->addr.family = nla_get_u16(tb[MPTCP_PM_ADDR_ATTR_FAMILY]); in mptcp_pm_parse_addr()
1128 if (entry->addr.family != AF_INET in mptcp_pm_parse_addr()
1130 && entry->addr.family != AF_INET6 in mptcp_pm_parse_addr()
1137 addr_addr = mptcp_pm_family_to_addr(entry->addr.family); in mptcp_pm_parse_addr()
1145 if (entry->addr.family == AF_INET6) in mptcp_pm_parse_addr()
1146 entry->addr.addr6 = nla_get_in6_addr(tb[addr_addr]); in mptcp_pm_parse_addr()
1149 entry->addr.addr.s_addr = nla_get_in_addr(tb[addr_addr]); in mptcp_pm_parse_addr()
1159 entry->addr.id = nla_get_u8(tb[MPTCP_PM_ADDR_ATTR_ID]); in mptcp_pm_parse_addr()
1170 entry->addr.port = htons(nla_get_u16(tb[MPTCP_PM_ADDR_ATTR_PORT])); in mptcp_pm_parse_addr()
1222 struct mptcp_pm_addr_entry addr, *entry; in mptcp_nl_cmd_add_addr() local
1225 ret = mptcp_pm_parse_addr(attr, info, true, &addr); in mptcp_nl_cmd_add_addr()
1235 *entry = addr; in mptcp_nl_cmd_add_addr()
1236 if (entry->addr.port) { in mptcp_nl_cmd_add_addr()
1265 if (entry->addr.id == id) in __lookup_addr_by_id()
1293 struct mptcp_addr_info *addr) in remove_anno_list_by_saddr() argument
1297 entry = mptcp_pm_del_add_timer(msk, addr, false); in remove_anno_list_by_saddr()
1308 struct mptcp_addr_info *addr, in mptcp_pm_remove_anno_addr() argument
1314 list.ids[list.nr++] = addr->id; in mptcp_pm_remove_anno_addr()
1316 ret = remove_anno_list_by_saddr(msk, addr); in mptcp_pm_remove_anno_addr()
1326 struct mptcp_addr_info *addr) in mptcp_nl_remove_subflow_and_signal_addr() argument
1332 pr_debug("remove_id=%d", addr->id); in mptcp_nl_remove_subflow_and_signal_addr()
1334 list.ids[list.nr++] = addr->id; in mptcp_nl_remove_subflow_and_signal_addr()
1341 mptcp_pm_remove_anno_addr(msk, addr, false); in mptcp_nl_remove_subflow_and_signal_addr()
1346 remove_subflow = lookup_subflow_by_saddr(&msk->conn_list, addr); in mptcp_nl_remove_subflow_and_signal_addr()
1347 mptcp_pm_remove_anno_addr(msk, addr, remove_subflow); in mptcp_nl_remove_subflow_and_signal_addr()
1369 struct mptcp_addr_info *addr) in mptcp_nl_remove_id_zero_address() argument
1385 if (!addresses_equal(&msk_local, addr, addr->port)) in mptcp_nl_remove_id_zero_address()
1407 struct mptcp_pm_addr_entry addr, *entry; in mptcp_nl_cmd_del_addr() local
1411 ret = mptcp_pm_parse_addr(attr, info, false, &addr); in mptcp_nl_cmd_del_addr()
1420 if (addr.addr.id == 0) in mptcp_nl_cmd_del_addr()
1421 return mptcp_nl_remove_id_zero_address(sock_net(skb->sk), &addr.addr); in mptcp_nl_cmd_del_addr()
1424 entry = __lookup_addr_by_id(pernet, addr.addr.id); in mptcp_nl_cmd_del_addr()
1441 __clear_bit(entry->addr.id, pernet->id_bitmap); in mptcp_nl_cmd_del_addr()
1444 mptcp_nl_remove_subflow_and_signal_addr(sock_net(skb->sk), &entry->addr); in mptcp_nl_cmd_del_addr()
1458 if (lookup_subflow_by_saddr(&msk->conn_list, &entry->addr) && in mptcp_pm_remove_addrs_and_subflows()
1461 alist.ids[alist.nr++] = entry->addr.id; in mptcp_pm_remove_addrs_and_subflows()
1462 slist.ids[slist.nr++] = entry->addr.id; in mptcp_pm_remove_addrs_and_subflows()
1463 } else if (remove_anno_list_by_saddr(msk, &entry->addr) && in mptcp_pm_remove_addrs_and_subflows()
1465 alist.ids[alist.nr++] = entry->addr.id; in mptcp_pm_remove_addrs_and_subflows()
1540 struct mptcp_addr_info *addr = &entry->addr; in mptcp_nl_fill_addr() local
1547 if (nla_put_u16(skb, MPTCP_PM_ADDR_ATTR_FAMILY, addr->family)) in mptcp_nl_fill_addr()
1549 if (nla_put_u16(skb, MPTCP_PM_ADDR_ATTR_PORT, ntohs(addr->port))) in mptcp_nl_fill_addr()
1551 if (nla_put_u8(skb, MPTCP_PM_ADDR_ATTR_ID, addr->id)) in mptcp_nl_fill_addr()
1559 if (addr->family == AF_INET && in mptcp_nl_fill_addr()
1561 addr->addr.s_addr)) in mptcp_nl_fill_addr()
1564 else if (addr->family == AF_INET6 && in mptcp_nl_fill_addr()
1565 nla_put_in6_addr(skb, MPTCP_PM_ADDR_ATTR_ADDR6, &addr->addr6)) in mptcp_nl_fill_addr()
1580 struct mptcp_pm_addr_entry addr, *entry; in mptcp_nl_cmd_get_addr() local
1585 ret = mptcp_pm_parse_addr(attr, info, false, &addr); in mptcp_nl_cmd_get_addr()
1602 entry = __lookup_addr_by_id(pernet, addr.addr.id); in mptcp_nl_cmd_get_addr()
1645 if (entry->addr.id <= id) in mptcp_nl_cmd_dump_addrs()
1659 id = entry->addr.id; in mptcp_nl_cmd_dump_addrs()
1744 struct mptcp_addr_info *addr, in mptcp_nl_addr_backup() argument
1759 ret = mptcp_pm_nl_mp_prio_send_ack(msk, addr, bkup); in mptcp_nl_addr_backup()
1775 struct mptcp_pm_addr_entry addr, *entry; in mptcp_nl_cmd_set_flags() local
1780 ret = mptcp_pm_parse_addr(attr, info, true, &addr); in mptcp_nl_cmd_set_flags()
1784 if (addr.flags & MPTCP_PM_ADDR_FLAG_BACKUP) in mptcp_nl_cmd_set_flags()
1788 entry = __lookup_addr(pernet, &addr.addr); in mptcp_nl_cmd_set_flags()
1798 addr = *entry; in mptcp_nl_cmd_set_flags()
1801 mptcp_nl_addr_backup(net, &addr.addr, bkup); in mptcp_nl_cmd_set_flags()
1995 if (nla_put_in_addr(skb, MPTCP_ATTR_DADDR4, info->addr.s_addr)) in mptcp_event_addr_announced()