Lines Matching refs:entry
156 struct mptcp_pm_addr_entry *entry, *ret = NULL; in select_local_address() local
161 list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) { in select_local_address()
162 if (!(entry->flags & MPTCP_PM_ADDR_FLAG_SUBFLOW)) in select_local_address()
165 if (!test_bit(entry->addr.id, msk->pm.id_avail_bitmap)) in select_local_address()
168 if (entry->addr.family != sk->sk_family) { in select_local_address()
170 if ((entry->addr.family == AF_INET && in select_local_address()
173 !ipv6_addr_v4mapped(&entry->addr.addr6))) in select_local_address()
178 ret = entry; in select_local_address()
188 struct mptcp_pm_addr_entry *entry, *ret = NULL; in select_signal_address() local
196 list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) { in select_signal_address()
197 if (!test_bit(entry->addr.id, msk->pm.id_avail_bitmap)) in select_signal_address()
200 if (!(entry->flags & MPTCP_PM_ADDR_FLAG_SIGNAL)) in select_signal_address()
203 ret = entry; in select_signal_address()
259 struct mptcp_pm_add_entry *entry; in mptcp_lookup_anno_list_by_saddr() local
263 list_for_each_entry(entry, &msk->pm.anno_list, list) { in mptcp_lookup_anno_list_by_saddr()
264 if (mptcp_addresses_equal(&entry->addr, addr, true)) in mptcp_lookup_anno_list_by_saddr()
265 return entry; in mptcp_lookup_anno_list_by_saddr()
273 struct mptcp_pm_add_entry *entry; in mptcp_pm_sport_in_anno_list() local
280 list_for_each_entry(entry, &msk->pm.anno_list, list) { in mptcp_pm_sport_in_anno_list()
281 if (mptcp_addresses_equal(&entry->addr, &saddr, true)) { in mptcp_pm_sport_in_anno_list()
294 struct mptcp_pm_add_entry *entry = from_timer(entry, timer, add_timer); in mptcp_pm_add_timer() local
295 struct mptcp_sock *msk = entry->sock; in mptcp_pm_add_timer()
306 if (!entry->addr.id) in mptcp_pm_add_timer()
317 pr_debug("retransmit ADD_ADDR id=%d", entry->addr.id); in mptcp_pm_add_timer()
318 mptcp_pm_announce_addr(msk, &entry->addr, false); in mptcp_pm_add_timer()
320 entry->retrans_times++; in mptcp_pm_add_timer()
323 if (entry->retrans_times < ADD_ADDR_RETRANS_MAX) in mptcp_pm_add_timer()
329 if (entry->retrans_times == ADD_ADDR_RETRANS_MAX) in mptcp_pm_add_timer()
340 struct mptcp_pm_add_entry *entry; in mptcp_pm_del_add_timer() local
344 entry = mptcp_lookup_anno_list_by_saddr(msk, addr); in mptcp_pm_del_add_timer()
345 if (entry && (!check_id || entry->addr.id == addr->id)) in mptcp_pm_del_add_timer()
346 entry->retrans_times = ADD_ADDR_RETRANS_MAX; in mptcp_pm_del_add_timer()
349 if (entry && (!check_id || entry->addr.id == addr->id)) in mptcp_pm_del_add_timer()
350 sk_stop_timer_sync(sk, &entry->add_timer); in mptcp_pm_del_add_timer()
352 return entry; in mptcp_pm_del_add_timer()
356 const struct mptcp_pm_addr_entry *entry) in mptcp_pm_alloc_anno_list() argument
364 add_entry = mptcp_lookup_anno_list_by_saddr(msk, &entry->addr); in mptcp_pm_alloc_anno_list()
381 add_entry->addr = entry->addr; in mptcp_pm_alloc_anno_list()
394 struct mptcp_pm_add_entry *entry, *tmp; in mptcp_pm_free_anno_list() local
404 list_for_each_entry_safe(entry, tmp, &free_list, list) { in mptcp_pm_free_anno_list()
405 sk_stop_timer_sync(sk, &entry->add_timer); in mptcp_pm_free_anno_list()
406 kfree(entry); in mptcp_pm_free_anno_list()
501 struct mptcp_pm_addr_entry *entry; in __lookup_addr_by_id() local
503 list_for_each_entry(entry, &pernet->local_addr_list, list) { in __lookup_addr_by_id()
504 if (entry->addr.id == id) in __lookup_addr_by_id()
505 return entry; in __lookup_addr_by_id()
514 struct mptcp_pm_addr_entry *entry; in __lookup_addr() local
516 list_for_each_entry(entry, &pernet->local_addr_list, list) { in __lookup_addr()
518 mptcp_addresses_equal(&entry->addr, info, entry->addr.port)) || in __lookup_addr()
519 (lookup_by_id && entry->addr.id == info->id)) in __lookup_addr()
520 return entry; in __lookup_addr()
543 struct mptcp_pm_addr_entry *entry; in mptcp_pm_create_subflow_or_signal_addr() local
549 entry = __lookup_addr(pernet, &mpc_addr, false); in mptcp_pm_create_subflow_or_signal_addr()
550 if (entry) { in mptcp_pm_create_subflow_or_signal_addr()
551 __clear_bit(entry->addr.id, msk->pm.id_avail_bitmap); in mptcp_pm_create_subflow_or_signal_addr()
552 msk->mpc_endpoint_id = entry->addr.id; in mptcp_pm_create_subflow_or_signal_addr()
553 backup = !!(entry->flags & MPTCP_PM_ADDR_FLAG_BACKUP); in mptcp_pm_create_subflow_or_signal_addr()
634 struct mptcp_pm_addr_entry *entry; in fill_local_addresses_vec() local
644 list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) { in fill_local_addresses_vec()
645 if (!(entry->flags & MPTCP_PM_ADDR_FLAG_FULLMESH)) in fill_local_addresses_vec()
648 if (entry->addr.family != sk->sk_family) { in fill_local_addresses_vec()
650 if ((entry->addr.family == AF_INET && in fill_local_addresses_vec()
653 !ipv6_addr_v4mapped(&entry->addr.addr6))) in fill_local_addresses_vec()
660 addrs[i++] = entry->addr; in fill_local_addresses_vec()
887 static bool address_use_port(struct mptcp_pm_addr_entry *entry) in address_use_port() argument
889 return (entry->flags & in address_use_port()
895 static void __mptcp_pm_release_addr_entry(struct mptcp_pm_addr_entry *entry) in __mptcp_pm_release_addr_entry() argument
897 if (entry->lsk) in __mptcp_pm_release_addr_entry()
898 sock_release(entry->lsk); in __mptcp_pm_release_addr_entry()
899 kfree(entry); in __mptcp_pm_release_addr_entry()
903 struct mptcp_pm_addr_entry *entry, in mptcp_pm_nl_append_new_local_addr() argument
918 if (test_bit(entry->addr.id, pernet->id_bitmap)) in mptcp_pm_nl_append_new_local_addr()
924 if (!address_use_port(entry)) in mptcp_pm_nl_append_new_local_addr()
925 entry->addr.port = 0; in mptcp_pm_nl_append_new_local_addr()
927 if (mptcp_addresses_equal(&cur->addr, &entry->addr, in mptcp_pm_nl_append_new_local_addr()
928 cur->addr.port || entry->addr.port)) { in mptcp_pm_nl_append_new_local_addr()
935 if (entry->addr.id) in mptcp_pm_nl_append_new_local_addr()
939 entry->addr.id = cur->addr.id; in mptcp_pm_nl_append_new_local_addr()
946 if (!entry->addr.id && needs_id) { in mptcp_pm_nl_append_new_local_addr()
948 entry->addr.id = find_next_zero_bit(pernet->id_bitmap, in mptcp_pm_nl_append_new_local_addr()
951 if (!entry->addr.id && pernet->next_id != 1) { in mptcp_pm_nl_append_new_local_addr()
957 if (!entry->addr.id && needs_id) in mptcp_pm_nl_append_new_local_addr()
960 __set_bit(entry->addr.id, pernet->id_bitmap); in mptcp_pm_nl_append_new_local_addr()
961 if (entry->addr.id > pernet->next_id) in mptcp_pm_nl_append_new_local_addr()
962 pernet->next_id = entry->addr.id; in mptcp_pm_nl_append_new_local_addr()
964 if (entry->flags & MPTCP_PM_ADDR_FLAG_SIGNAL) { in mptcp_pm_nl_append_new_local_addr()
968 if (entry->flags & MPTCP_PM_ADDR_FLAG_SUBFLOW) { in mptcp_pm_nl_append_new_local_addr()
974 if (!entry->addr.port) in mptcp_pm_nl_append_new_local_addr()
975 list_add_tail_rcu(&entry->list, &pernet->local_addr_list); in mptcp_pm_nl_append_new_local_addr()
977 list_add_rcu(&entry->list, &pernet->local_addr_list); in mptcp_pm_nl_append_new_local_addr()
978 ret = entry->addr.id; in mptcp_pm_nl_append_new_local_addr()
995 struct mptcp_pm_addr_entry *entry) in mptcp_pm_nl_create_listen_socket() argument
1005 err = sock_create_kern(sock_net(sk), entry->addr.family, in mptcp_pm_nl_create_listen_socket()
1006 SOCK_STREAM, IPPROTO_MPTCP, &entry->lsk); in mptcp_pm_nl_create_listen_socket()
1010 newsk = entry->lsk->sk; in mptcp_pm_nl_create_listen_socket()
1032 mptcp_info2sockaddr(&entry->addr, &addr, entry->addr.family); in mptcp_pm_nl_create_listen_socket()
1034 if (entry->addr.family == AF_INET6) in mptcp_pm_nl_create_listen_socket()
1055 struct mptcp_pm_addr_entry *entry; in mptcp_pm_nl_get_local_id() local
1078 list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) { in mptcp_pm_nl_get_local_id()
1079 if (mptcp_addresses_equal(&entry->addr, &skc_local, entry->addr.port)) { in mptcp_pm_nl_get_local_id()
1080 ret = entry->addr.id; in mptcp_pm_nl_get_local_id()
1089 entry = kmalloc(sizeof(*entry), GFP_ATOMIC); in mptcp_pm_nl_get_local_id()
1090 if (!entry) in mptcp_pm_nl_get_local_id()
1093 entry->addr = skc_local; in mptcp_pm_nl_get_local_id()
1094 entry->addr.id = 0; in mptcp_pm_nl_get_local_id()
1095 entry->addr.port = 0; in mptcp_pm_nl_get_local_id()
1096 entry->ifindex = 0; in mptcp_pm_nl_get_local_id()
1097 entry->flags = MPTCP_PM_ADDR_FLAG_IMPLICIT; in mptcp_pm_nl_get_local_id()
1098 entry->lsk = NULL; in mptcp_pm_nl_get_local_id()
1099 ret = mptcp_pm_nl_append_new_local_addr(pernet, entry, true); in mptcp_pm_nl_get_local_id()
1101 kfree(entry); in mptcp_pm_nl_get_local_id()
1258 struct mptcp_pm_addr_entry *entry) in mptcp_pm_parse_entry() argument
1263 memset(entry, 0, sizeof(*entry)); in mptcp_pm_parse_entry()
1265 err = mptcp_pm_parse_pm_addr_attr(tb, attr, info, &entry->addr, require_family); in mptcp_pm_parse_entry()
1272 entry->ifindex = val; in mptcp_pm_parse_entry()
1276 entry->flags = nla_get_u32(tb[MPTCP_PM_ADDR_ATTR_FLAGS]); in mptcp_pm_parse_entry()
1279 entry->addr.port = htons(nla_get_u16(tb[MPTCP_PM_ADDR_ATTR_PORT])); in mptcp_pm_parse_entry()
1331 struct mptcp_pm_addr_entry addr, *entry; in mptcp_nl_cmd_add_addr() local
1354 entry = kzalloc(sizeof(*entry), GFP_KERNEL_ACCOUNT); in mptcp_nl_cmd_add_addr()
1355 if (!entry) { in mptcp_nl_cmd_add_addr()
1360 *entry = addr; in mptcp_nl_cmd_add_addr()
1361 if (entry->addr.port) { in mptcp_nl_cmd_add_addr()
1362 ret = mptcp_pm_nl_create_listen_socket(skb->sk, entry); in mptcp_nl_cmd_add_addr()
1368 ret = mptcp_pm_nl_append_new_local_addr(pernet, entry, in mptcp_nl_cmd_add_addr()
1379 __mptcp_pm_release_addr_entry(entry); in mptcp_nl_cmd_add_addr()
1386 struct mptcp_pm_addr_entry *entry; in mptcp_pm_get_flags_and_ifindex_by_id() local
1401 entry = __lookup_addr_by_id(pm_nl_get_pernet(net), id); in mptcp_pm_get_flags_and_ifindex_by_id()
1402 if (entry) { in mptcp_pm_get_flags_and_ifindex_by_id()
1403 *flags = entry->flags; in mptcp_pm_get_flags_and_ifindex_by_id()
1404 *ifindex = entry->ifindex; in mptcp_pm_get_flags_and_ifindex_by_id()
1415 struct mptcp_pm_add_entry *entry; in remove_anno_list_by_saddr() local
1417 entry = mptcp_pm_del_add_timer(msk, addr, false); in remove_anno_list_by_saddr()
1418 if (entry) { in remove_anno_list_by_saddr()
1419 list_del(&entry->list); in remove_anno_list_by_saddr()
1420 kfree(entry); in remove_anno_list_by_saddr()
1446 const struct mptcp_pm_addr_entry *entry) in mptcp_nl_remove_subflow_and_signal_addr() argument
1448 const struct mptcp_addr_info *addr = &entry->addr; in mptcp_nl_remove_subflow_and_signal_addr()
1472 !(entry->flags & MPTCP_PM_ADDR_FLAG_IMPLICIT)); in mptcp_nl_remove_subflow_and_signal_addr()
1524 struct mptcp_pm_addr_entry addr, *entry; in mptcp_nl_cmd_del_addr() local
1541 entry = __lookup_addr_by_id(pernet, addr.addr.id); in mptcp_nl_cmd_del_addr()
1542 if (!entry) { in mptcp_nl_cmd_del_addr()
1547 if (entry->flags & MPTCP_PM_ADDR_FLAG_SIGNAL) { in mptcp_nl_cmd_del_addr()
1551 if (entry->flags & MPTCP_PM_ADDR_FLAG_SUBFLOW) { in mptcp_nl_cmd_del_addr()
1557 list_del_rcu(&entry->list); in mptcp_nl_cmd_del_addr()
1558 __clear_bit(entry->addr.id, pernet->id_bitmap); in mptcp_nl_cmd_del_addr()
1561 mptcp_nl_remove_subflow_and_signal_addr(sock_net(skb->sk), entry); in mptcp_nl_cmd_del_addr()
1563 __mptcp_pm_release_addr_entry(entry); in mptcp_nl_cmd_del_addr()
1571 struct mptcp_pm_addr_entry *entry; in mptcp_pm_remove_addrs() local
1573 list_for_each_entry(entry, rm_list, list) { in mptcp_pm_remove_addrs()
1574 if ((remove_anno_list_by_saddr(msk, &entry->addr) || in mptcp_pm_remove_addrs()
1575 lookup_subflow_by_saddr(&msk->conn_list, &entry->addr)) && in mptcp_pm_remove_addrs()
1577 alist.ids[alist.nr++] = entry->addr.id; in mptcp_pm_remove_addrs()
1591 struct mptcp_pm_addr_entry *entry; in mptcp_pm_remove_addrs_and_subflows() local
1593 list_for_each_entry(entry, rm_list, list) { in mptcp_pm_remove_addrs_and_subflows()
1594 if (lookup_subflow_by_saddr(&msk->conn_list, &entry->addr) && in mptcp_pm_remove_addrs_and_subflows()
1596 slist.ids[slist.nr++] = entry->addr.id; in mptcp_pm_remove_addrs_and_subflows()
1598 if (remove_anno_list_by_saddr(msk, &entry->addr) && in mptcp_pm_remove_addrs_and_subflows()
1600 alist.ids[alist.nr++] = entry->addr.id; in mptcp_pm_remove_addrs_and_subflows()
1674 struct mptcp_pm_addr_entry *entry) in mptcp_nl_fill_addr() argument
1676 struct mptcp_addr_info *addr = &entry->addr; in mptcp_nl_fill_addr()
1689 if (nla_put_u32(skb, MPTCP_PM_ADDR_ATTR_FLAGS, entry->flags)) in mptcp_nl_fill_addr()
1691 if (entry->ifindex && in mptcp_nl_fill_addr()
1692 nla_put_s32(skb, MPTCP_PM_ADDR_ATTR_IF_IDX, entry->ifindex)) in mptcp_nl_fill_addr()
1716 struct mptcp_pm_addr_entry addr, *entry; in mptcp_nl_cmd_get_addr() local
1738 entry = __lookup_addr_by_id(pernet, addr.addr.id); in mptcp_nl_cmd_get_addr()
1739 if (!entry) { in mptcp_nl_cmd_get_addr()
1745 ret = mptcp_nl_fill_addr(msg, entry); in mptcp_nl_cmd_get_addr()
1766 struct mptcp_pm_addr_entry *entry; in mptcp_nl_cmd_dump_addrs() local
1777 entry = __lookup_addr_by_id(pernet, i); in mptcp_nl_cmd_dump_addrs()
1778 if (!entry) in mptcp_nl_cmd_dump_addrs()
1781 if (entry->addr.id <= id) in mptcp_nl_cmd_dump_addrs()
1790 if (mptcp_nl_fill_addr(msg, entry) < 0) { in mptcp_nl_cmd_dump_addrs()
1795 id = entry->addr.id; in mptcp_nl_cmd_dump_addrs()
1923 struct mptcp_pm_addr_entry addr = { .addr = { .family = AF_UNSPEC }, }, *entry; in mptcp_nl_cmd_set_flags() local
1958 entry = __lookup_addr(pernet, &addr.addr, lookup_by_id); in mptcp_nl_cmd_set_flags()
1959 if (!entry) { in mptcp_nl_cmd_set_flags()
1964 (entry->flags & MPTCP_PM_ADDR_FLAG_SIGNAL)) { in mptcp_nl_cmd_set_flags()
1969 changed = (addr.flags ^ entry->flags) & mask; in mptcp_nl_cmd_set_flags()
1970 entry->flags = (entry->flags & ~mask) | (addr.flags & mask); in mptcp_nl_cmd_set_flags()
1971 addr = *entry; in mptcp_nl_cmd_set_flags()