Modify

Opened 9 years ago

Closed 7 years ago

Last modified 4 years ago

#4688 closed defect (worksforme)

race condition between network and firewall

Reported by: icarus75 Owned by: thepeople
Priority: high Milestone: Barrier Breaker 14.07
Component: base system Version: Kamikaze trunk
Keywords: network firewall dhcp racecondition Cc:

Description

I've flashed the latest kamikaze 8.09 on a fonera 2200, then configured this fonera to act in client mode (sta). However, when booting, the ath0 interface doens't get a proper dhcp lease from the other router. In fact, from the syslog readout it seems that the udhcpc process receives a SIGTERM just after sending out the discover:

Jan 1 00:00:47 flukso user.info : udhcpc (v1.11.2) started
Jan 1 00:00:51 flukso user.info : Sending discover...
Jan 1 00:00:51 flukso user.info : Loading defaults
Jan 1 00:00:51 flukso user.info : Received SIGTERM
Jan 1 00:00:51 flukso user.info : Entering released state
Jan 1 00:00:52 flukso user.info : Loading synflood protection
Jan 1 00:00:52 flukso user.info : Adding custom chains
Jan 1 00:00:52 flukso user.info : Loading zones
Jan 1 00:00:53 flukso user.info : Loading rules
Jan 1 00:00:53 flukso user.info : Loading forwarding
Jan 1 00:00:53 flukso user.info : Loading redirects
Jan 1 00:00:53 flukso user.info : Loading includes
Jan 1 00:00:55 flukso user.notice root: adding lan (eth0) to firewall zone lan

Perhaps only 1 in 10 wrt boots results in a proper IP config. When unsuccessful, I can always see a SIGTERM during the dhcp discovery process and no udhcpc in the process list. Running the 'wifi' command after an unsuccessful boot results in a dhcp lease.

I'm suspecting that there might be a race condition between network and firewall config at hand: when changing the boot sequence of the firewall from S45firewall to S30firewall, I'm always getting successful leases.

Attachments (0)

Change History (5)

comment:1 Changed 9 years ago by icarus75

Update:

Due to the unpredictable nature of this error, I mistakenly thought that it was due to a race condition between network and firewall init. Further investigation points to a race condition between network and udhcpc init.

When restarting the network services repeatedly, I occasionally get into following error condition:
root@flukso:~# /etc/init.d/network restart
udhcpc (v1.11.2) started
Sending discover...
udhcpc: sendto: Network is down
killall: ntpclient: no process killed
Received SIGTERM
Entering released state

Although the wifi interface does come up, the udhcpc process is terminated by the SIGTERM. So in the end, no IP address is assigned to the ath0 itf.

comment:2 Changed 9 years ago by icarus75

Update 2:

I've compiled busybox with BUSYBOX_CONFIG_FEATURE_UDHCP_DEBUG enabled. Apparently, the udhcpc tries to read from a raw listening socket which then triggers a SIGTERM:

without patch:
root@flukso:~# /etc/init.d/network restart
### adapter index 4
### adapter hardware address 00:18:84:81:55:c1
udhcpc (v1.11.2) started
### vfork'ing and execle'ing /usr/share/udhcpc/default.script
### entering raw listen mode
### adapter index 5
### adapter hardware address 00:18:84:81:55:c1
### opening raw socket on ifindex 5
### got raw socket fd 5
### attached filter to raw socket fd 5
### bound to raw socket fd 5
### adding option 0x35
### adding option 0x3d
### adding option 0x3c
### adding option 0x39
Sending discover...
udhcpc: sendto: Network is down
### adapter index 5
### adapter hardware address 00:18:84:81:55:c1
### Waiting on select...
### Cannot read on raw listening socket - ignoring
### error on read, Network is down, reopening socket
### entering raw listen mode
### adapter index 5
### adapter hardware address 00:18:84:81:55:c1
### opening raw socket on ifindex 5
### got raw socket fd 5
### attached filter to raw socket fd 5
### bound to raw socket fd 5
### Waiting on select...
Received SIGTERM
Entering released state
### entering none listen mode

The patch in attachment just ignores the SIGTERM and continues to listen on the socket:
root@flukso:~# /etc/init.d/network restart
### adapter index 4
### adapter hardware address 00:18:84:81:55:c1
udhcpc (v1.11.2) started
### vfork'ing and execle'ing /usr/share/udhcpc/default.script
### entering raw listen mode
### adapter index 5
### adapter hardware address 00:18:84:81:55:c1
### opening raw socket on ifindex 5
### got raw socket fd 5
### attached filter to raw socket fd 5
### bound to raw socket fd 5
### adding option 0x35
### adding option 0x3d
### adding option 0x3c
### adding option 0x32
### adding option 0x39
Sending discover...
udhcpc: sendto: Network is down
### adapter index 5
### adapter hardware address 00:18:84:81:55:c1
### Waiting on select...
### Cannot read on raw listening socket - ignoring
### error on read, Network is down, reopening socket
### entering raw listen mode
### adapter index 5
### adapter hardware address 00:18:84:81:55:c1
### opening raw socket on ifindex 5
### got raw socket fd 5
### attached filter to raw socket fd 5
### bound to raw socket fd 5
### Waiting on select...
Received SIGTERM: ignoring[[BR]]
### adapter index 5
### adapter hardware address 00:18:84:81:55:c1
### Waiting on select...
### Cannot read on raw listening socket - ignoring
### error on read, Network is down, reopening socket
### entering raw listen mode
### adapter index 5
### adapter hardware address 00:18:84:81:55:c1
### opening raw socket on ifindex 5
### got raw socket fd 5
### attached filter to raw socket fd 5
### bound to raw socket fd 5
### adding option 0x35
### adding option 0x3d
### adding option 0x3c
### adding option 0x32
### adding option 0x39
Sending discover...
### adapter index 5
### adapter hardware address 00:18:84:81:55:c1
### Waiting on select...
### Got valid DHCP packet
### adapter index 5
### adapter hardware address 00:18:84:81:55:c1
### adding option 0x35
### adding option 0x3d
### adding option 0x3c
### adding option 0x32
### adding option 0x36
Sending select for 192.168.1.202...
### adapter index 5
### adapter hardware address 00:18:84:81:55:c1
### Waiting on select...
### Got valid DHCP packet
Lease of 192.168.1.202 obtained, lease time 43200
### vfork'ing and execle'ing /usr/share/udhcpc/default.script
adding router 192.168.1.1
deleting old routes
adding dns 192.168.1.1
### entering none listen mode

patch:
--- dhcpc.c.11.2 2009-02-24 16:22:10.000000000 +0100
+++ dhcpc.c 2009-02-24 16:23:05.000000000 +0100
@@ -616,10 +616,10 @@

timeout = INT_MAX;
break;

case SIGTERM:

  • bb_info_msg("Received SIGTERM");
  • if (opt & OPT_R) /* release on quit */
  • perform_release(requested_ip, server_addr);
  • goto ret0;

+ bb_info_msg("Received SIGTERM: ignoring!");
+ if (opt & OPT_R) /* release on quit */
+
perform_release(requested_ip, server_addr);
+ goto ret0;

}

}

} /* for (;;) - main loop ends */

Cheers,
Bart.

comment:3 Changed 8 years ago by thepeople

  • Owner changed from developers to thepeople
  • Status changed from new to assigned
  • Version set to Kamikaze trunk

comment:4 Changed 7 years ago by nbd

  • Resolution set to worksforme
  • Status changed from assigned to closed

old bug, should be working now

comment:5 Changed 4 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.