Opened 17 years ago

Closed 11 years ago

Last modified 10 years ago

#2185 closed enhancement (wontfix)

Check carrier status in DHCP client scripts

Reported by: dnicholson@… Owned by: Bruce Dubbs
Priority: normal Milestone:
Component: Bootscripts Version: SVN
Severity: normal Keywords: network


Instead of blindly running dhcp and waiting for it to timeout, we can query whether the network card is attached to anything first through a couple methods. See further discussion here:

Change History (15)

comment:1 by bdubbs@…, 17 years ago

Will this method work for wifi network connections? I think there may be a lot of variation here in how this is handled. In my case, I created a script that links and establishes ath0 and then run a process to give the interface an ip address (fixed or dhcp). Its hard to determine in advance how someone will use a wifi connection. Perhaps a general discussion in the configuration section giving exaples of various options would be appropriate.

comment:2 by dnicholson@…, 17 years ago

Milestone: 6.2.0future
Status: newassigned

Punting this for now. I like the idea, but I don't think we need to be toying with the network scripts at this stage in the game. Especially since I'm proposing it and it doesn't even work on my network card.

comment:3 by DJ Lucas, 16 years ago

What is the status on this one? Seems a fairly simple modification as long as the /sys method tests reliably on several devices. Actually, come to think of it, this should probably be done in the ifup script in LFS. I'm not sure if this would affect Bruce's wireless scripts however. It'd have to wait until after the 6.3 release, but this or something similar looks well in my ifup (pardon the fake diff):

+ # Only process the config file if the device is actually connected + # to media. + if [ "cat /sys/class/net/${1}/carrier" = 1 ] + then

  • IFCONFIG=${file} ${NETWORK_DEVICES}/services/${SERVICE} ${1} up

+ IFCONFIG=${file} ${NETWORK_DEVICES}/services/${SERVICE} ${1} up + else + echo -e "${WARNING} The ${1} device has no connection!" + echo -en "${CURS_UP}" + log_warning_msg + fi

comment:4 by DJ Lucas, 16 years ago

+            # Only process the config file if the device is actually connected
+            # to media.
+            if [ "`cat /sys/class/net/${1}/carrier`" = 1 ]
+            then
-            IFCONFIG=${file} ${NETWORK_DEVICES}/services/${SERVICE} ${1} up
+                IFCONFIG=${file} ${NETWORK_DEVICES}/services/${SERVICE} ${1} up
+            else
+                echo -e "${WARNING}     The ${1} device has no connection!"
+                echo -en "${CURS_UP}"
+                log_warning_msg
+            fi

comment:5 by dnicholson@…, 16 years ago

For wired connections, checking the carrier status works. For wireless connections, the carrier or "up" status is mostly useless. On one of my ethernet cards, the kernel driver doesn't update the carrier status. I have a bug open in the kernel bugzilla, but it hasn't been addressed.

In that case, the carrier is always 1, so there wouldn't be any regression as the network scripts would just carry on as they do now. Still, I think it would need some wider testing from people with various cards.

I think we should just put this in after 6.3 and let people report on how it works for them.

comment:6 by Randy McMurchy, 15 years ago

Milestone: future6.4
Owner: changed from dnicholson@… to blfs-book@…
Status: assignednew

comment:7 by bdubbs@…, 15 years ago

Component: BOOKBootscripts

comment:8 by Randy McMurchy, 14 years ago

Milestone: 6.46.5

Modified milestone from 6.4 to 6.5

comment:9 by (none), 13 years ago

Milestone: 6.5

Milestone 6.5 deleted

comment:10 by Randy McMurchy, 13 years ago

Milestone: 6.7

Updated milestone to 6.7

comment:11 by bdubbs@…, 12 years ago

Milestone: 6.7current

comment:12 by bdubbs@…, 12 years ago

Owner: changed from blfs-book@… to Bruce Dubbs
Status: newassigned

comment:13 by bdubbs@…, 11 years ago

I know this is an old ticket, but don't know if we should fix it or not. First of all, the interface must be set 'up' before checking /sys/class/net/${1}/carrier, otherwise an error is returned. Secondly, I found that it takes about two seconds after the interface is set up for the carrier to change from 0 to 1 for a static IP on my system.

I really don't want want to but a sleep into the boot scripts.

We could make the check optional in ifconfig.eth0 with a variable like CHECK_CARRIER.

Also, I think this would only be applicable to wired connections.

I'd like to get feedback before continuing.

comment:14 by bdubbs@…, 11 years ago

Resolution: wontfix
Status: assignedclosed

Making wontfix due to lack of feedback.

comment:15 by bdubbs@…, 10 years ago

Milestone: current

Milestone current deleted

Note: See TracTickets for help on using tickets.