#define MAC_ADDRESS_LENGTH 6
#define WLAN_MAC_ADDR_MAX 20
#define ARP_SOURCE_IP "0.0.0.0"
+#define INITIAL_BURST_ARP_COUNT 5
-#define MIN_ARP_SEND_TIME 2000
+#define CONFLICT_REMOVE_ITERATION_LIMIT 4
+#define MIN_ARP_SEND_TIME 20000
+#define BURST_ARP_SEND_TIME 3000
#define MAX_ARP_SEND_TIME 32000
#define GRATUITOUS_ARP_MAC_ADDR "00:00:00:00:00:00"
#define UCHAR_TO_ADDRESS(hwaddr, buf) do {\
};
int ioctl_sock;
+static bool initial_bursts = true;
bool is_ip_conflict_detect_enabled = true;
static gboolean send_arp(gpointer data);
static void __netconfig_wifi_notify_ip_conflict(char *state, char *mac);
if (sd->timer_id != -1)
g_source_remove(sd->timer_id);
- if (conflict_state != NETCONFIG_IP_CONFLICT_STATE_CONFLICT_NOT_DETECTED && sd->iteration == 5) {
+ if (conflict_state != NETCONFIG_IP_CONFLICT_STATE_CONFLICT_NOT_DETECTED &&
+ sd->iteration == CONFLICT_REMOVE_ITERATION_LIMIT) {
sd->iteration = 0;
conflict_state = NETCONFIG_IP_CONFLICT_STATE_CONFLICT_NOT_DETECTED;
__netconfig_wifi_notify_ip_conflict("resolved", GRATUITOUS_ARP_MAC_ADDR);
+ initial_bursts = true;
}
sd->timer_id = g_timeout_add(sd->timeout, send_arp, sd);
INFO("ip conflict is detected !\n");
conflict_state = NETCONFIG_IP_CONFLICT_STATE_CONFLICT_DETECTED;
__netconfig_wifi_notify_ip_conflict("conflict", sbuf);
+ sd->timeout = BURST_ARP_SEND_TIME;
}
if (sd->arp_reply_timer != -1) {
int ifindex = 0;
errno = 0;
const char *default_ip = NULL;
+ static int initial_send_arp_count = 0;
+
+ if (initial_bursts && initial_send_arp_count >= INITIAL_BURST_ARP_COUNT) {
+ initial_bursts = false;
+ initial_send_arp_count = 0;
+ }
+
+ if (initial_bursts)
+ initial_send_arp_count++;
const char *mac = netconfig_get_default_mac_address();
if (mac == NULL)
g_source_remove(sd->timer_id);
- sd->timeout = td.initial_time;
+ if (conflict_state == NETCONFIG_IP_CONFLICT_STATE_CONFLICT_DETECTED || initial_bursts)
+ sd->timeout = BURST_ARP_SEND_TIME;
+ else
+ sd->timeout = td.initial_time;
/* Adding timeout callback for arp request */
sd->arp_reply_timer = g_timeout_add(1000, __arp_reply_timeout_cb,
}
char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
+ initial_bursts = true;
sd = g_try_malloc0(sizeof(struct sock_data));
if (sd == NULL) {