Lines Matching +full:current +full:- +full:limiting

6  * SPDX-License-Identifier: Apache-2.0
59 /* Max conflicts before rate limiting */
96 struct net_if *iface = net_if_get_by_index(ifaddr->ifindex); in ipv4_acd_send_probe()
100 pkt = ipv4_acd_prepare_arp(iface, &unspecified, &ifaddr->address.in_addr); in ipv4_acd_send_probe()
113 struct net_if *iface = net_if_get_by_index(ifaddr->ifindex); in ipv4_acd_send_announcement()
116 pkt = ipv4_acd_prepare_arp(iface, &ifaddr->address.in_addr, in ipv4_acd_send_announcement()
117 &ifaddr->address.in_addr); in ipv4_acd_send_announcement()
138 if (sys_timepoint_cmp(ifaddr->acd_timeout, expiry) < 0) { in acd_timer_reschedule()
139 expiry = ifaddr->acd_timeout; in acd_timer_reschedule()
154 switch (ifaddr->acd_state) { in ipv4_acd_manage_timeout()
156 if (ifaddr->acd_count < IPV4_ACD_PROBE_NUM) { in ipv4_acd_manage_timeout()
160 net_sprint_ipv4_addr(&ifaddr->address.in_addr)); in ipv4_acd_manage_timeout()
164 ifaddr->acd_count++; in ipv4_acd_manage_timeout()
165 if (ifaddr->acd_count < IPV4_ACD_PROBE_NUM) { in ipv4_acd_manage_timeout()
167 delay %= MSEC_PER_SEC * (IPV4_ACD_PROBE_MAX - IPV4_ACD_PROBE_MIN); in ipv4_acd_manage_timeout()
174 ifaddr->acd_timeout = sys_timepoint_calc(K_MSEC(delay)); in ipv4_acd_manage_timeout()
179 net_if_ipv4_acd_succeeded(net_if_get_by_index(ifaddr->ifindex), in ipv4_acd_manage_timeout()
182 ifaddr->acd_state = IPV4_ACD_ANNOUNCE; in ipv4_acd_manage_timeout()
183 ifaddr->acd_count = 0; in ipv4_acd_manage_timeout()
186 if (ifaddr->acd_count < IPV4_ACD_ANNOUNCE_NUM) { in ipv4_acd_manage_timeout()
188 net_sprint_ipv4_addr(&ifaddr->address.in_addr)); in ipv4_acd_manage_timeout()
192 ifaddr->acd_count++; in ipv4_acd_manage_timeout()
193 ifaddr->acd_timeout = sys_timepoint_calc( in ipv4_acd_manage_timeout()
200 net_sprint_ipv4_addr(&ifaddr->address.in_addr)); in ipv4_acd_manage_timeout()
205 ifaddr->acd_timeout = sys_timepoint_calc(K_NO_WAIT); in ipv4_acd_manage_timeout()
207 sys_slist_find_and_remove(&active_acd_timers, &ifaddr->acd_node); in ipv4_acd_manage_timeout()
216 sys_snode_t *current, *next; in ipv4_acd_timeout() local
222 SYS_SLIST_FOR_EACH_NODE_SAFE(&active_acd_timers, current, next) { in ipv4_acd_timeout()
224 CONTAINER_OF(current, struct net_if_addr, acd_node); in ipv4_acd_timeout()
226 if (sys_timepoint_expired(ifaddr->acd_timeout)) { in ipv4_acd_timeout()
240 sys_slist_find_and_remove(&active_acd_timers, &ifaddr->acd_node); in acd_start_timer()
241 sys_slist_append(&active_acd_timers, &ifaddr->acd_node); in acd_start_timer()
243 if (iface->config.ip.ipv4->conflict_cnt >= IPV4_ACD_MAX_CONFLICTS) { in acd_start_timer()
244 NET_DBG("Rate limiting"); in acd_start_timer()
253 ifaddr->acd_timeout = sys_timepoint_calc(K_MSEC(delay)); in acd_start_timer()
260 sys_snode_t *current, *next; in net_ipv4_acd_input() local
274 SYS_SLIST_FOR_EACH_NODE_SAFE(&active_acd_timers, current, next) { in net_ipv4_acd_input()
276 CONTAINER_OF(current, struct net_if_addr, acd_node); in net_ipv4_acd_input()
277 struct net_if *addr_iface = net_if_get_by_index(ifaddr->ifindex); in net_ipv4_acd_input()
284 if (ifaddr->acd_state != IPV4_ACD_PROBE) { in net_ipv4_acd_input()
291 * - ARP Request/Reply with Sender IP address match OR, in net_ipv4_acd_input()
292 * - ARP Probe where Target IP address match with different sender HW address, in net_ipv4_acd_input()
294 * ARP Probe has an all-zero sender IP address in net_ipv4_acd_input()
296 if (net_ipv4_addr_cmp_raw(arp_hdr->src_ipaddr, in net_ipv4_acd_input()
297 (uint8_t *)&ifaddr->address.in_addr) || in net_ipv4_acd_input()
298 (net_ipv4_addr_cmp_raw(arp_hdr->dst_ipaddr, in net_ipv4_acd_input()
299 (uint8_t *)&ifaddr->address.in_addr) && in net_ipv4_acd_input()
300 (memcmp(&arp_hdr->src_hwaddr, ll_addr->addr, ll_addr->len) != 0) && in net_ipv4_acd_input()
301 (net_ipv4_addr_cmp_raw(arp_hdr->src_ipaddr, in net_ipv4_acd_input()
304 net_sprint_ll_addr((uint8_t *)&arp_hdr->src_hwaddr, in net_ipv4_acd_input()
305 arp_hdr->hwlen), in net_ipv4_acd_input()
306 net_sprint_ipv4_addr(&ifaddr->address.in_addr)); in net_ipv4_acd_input()
308 iface->config.ip.ipv4->conflict_cnt++; in net_ipv4_acd_input()
320 ipv4 = iface->config.ip.ipv4; in net_ipv4_acd_input()
325 /* Passive conflict detection - try to defend already confirmed in net_ipv4_acd_input()
328 ARRAY_FOR_EACH(ipv4->unicast, i) { in net_ipv4_acd_input()
329 struct net_if_addr *ifaddr = &ipv4->unicast[i].ipv4; in net_ipv4_acd_input()
332 if (!ifaddr->is_used) { in net_ipv4_acd_input()
336 if (net_ipv4_addr_cmp_raw(arp_hdr->src_ipaddr, in net_ipv4_acd_input()
337 (uint8_t *)&ifaddr->address.in_addr) && in net_ipv4_acd_input()
338 memcmp(&arp_hdr->src_hwaddr, ll_addr->addr, ll_addr->len) != 0) { in net_ipv4_acd_input()
340 net_sprint_ll_addr((uint8_t *)&arp_hdr->src_hwaddr, in net_ipv4_acd_input()
341 arp_hdr->hwlen), in net_ipv4_acd_input()
342 net_sprint_ipv4_addr(&ifaddr->address.in_addr)); in net_ipv4_acd_input()
344 ipv4->conflict_cnt++; in net_ipv4_acd_input()
349 if (sys_timepoint_expired(ifaddr->acd_timeout)) { in net_ipv4_acd_input()
351 net_sprint_ipv4_addr(&ifaddr->address.in_addr)); in net_ipv4_acd_input()
353 ifaddr->acd_timeout = sys_timepoint_calc( in net_ipv4_acd_input()
357 net_sprint_ipv4_addr(&ifaddr->address.in_addr)); in net_ipv4_acd_input()
363 &ifaddr->address.in_addr, in net_ipv4_acd_input()
393 ifaddr->ifindex = net_if_get_by_iface(iface); in net_ipv4_acd_start()
394 ifaddr->acd_state = IPV4_ACD_PROBE; in net_ipv4_acd_start()
395 ifaddr->acd_count = 0; in net_ipv4_acd_start()
416 sys_slist_find_and_remove(&active_acd_timers, &ifaddr->acd_node); in net_ipv4_acd_cancel()