ltib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Ltib] udhcpc gets different addr


From: Stuart Hughes
Subject: Re: [Ltib] udhcpc gets different addr
Date: Wed, 11 Nov 2009 16:55:30 +0000
User-agent: Thunderbird 2.0.0.16 (X11/20080707)

Hi Michael,

You can do what you're trying to do without this patch, but it does need a config change. Here's what's happening:

In the BSP you have, the config is probably setup to use dhcp to get the IP address. You can verify this by running ./ltib -m config and checking in: Target System Configuration / Network setup / If the option: "get network parameters using dhcp" is checked then the network rc script will call ucdhcp. The problem you're runing into happens to me, that is if I use NFS deployment and forget to set the IP address to something static, then I get a load of "rpc 101..." as the IP address from dhcpd is different to the one the kernel got. I guess this maybe a bug in udhcpcd, not really sure.

I quite like your solution. I think though it might be possible to improve it. Rather than having to disable the network interface, it could be left on and in the network script you can test the deployment style and if it's NFS and dhcp is enabled, it could use your method instead to get the correctly assigned dynamic IP that the kernel has. The nice thing about this is it means you don't have to fiddle around with the configuration of the image, which means both jffs2 and NFS work without re-build/changes.

If you get what I mean maybe you could try this and send a patch? if not I could try to look at this when time permits.

Thanks for the patch.

Regards, Stuart

Michael Jones wrote:
Hi LTIBbers,

I have had the problem that I can't boot into the rootfs/ directory using NFS if LTIB built "rootfs/" destined for a jffs2 image, because of a problem with DHCP. I can only use NFS if I tell LTIB that I want Target image: "NFS only". But I would like to be able to always build the jffs2 image and still have the option of mounting via NFS.

Here's the problem: in my kernel config, I have CONFIG_IP_PNP_BOOTP=y. This is necessary for NFS to work, to get an IP address before trying to mount the root FS. After mounting rootfs/, if DEPLOYMENT_STYLE is anything but "NFS", udhcp is called to get an IP. Because my kernel config already got me an IP, this should just be a (safe) redundant step, but for some reason, my DHCP server gives me a _different_ IP address than I was given during kernel boot. As soon as my IP changes, my NFS is of course hosed.

With the assurance that my kernel will take care of configuring the IP address before mounting the RFS, I'm unchecking "Enable interface 0" in LTIB (SYSCFG_IFACE0=n), but then I get the misleading warning from "/etc/rc.d/init.d/network" that "Warning: no IPADDR is set, ...". I've added the following patch below to my skell package so I don't get this message unless "ifconfig" doesn't have an address for eth0.

I don't mean to complain of a problem with LTIB here, because it seems my DHCP server is misbehaving. Does anybody have a suggestion why the kernel DHCP and the udhcpc requests yield different addresses? Do you think my skell fix is hideous or problematic?

thanks,
Michael


$ diff -u rpm/BUILD/skell-1.16/etc/rc.d/init.d/network rootfs/etc/rc.d/init.d/network --- rpm/BUILD/skell-1.16/etc/rc.d/init.d/network 2007-06-18 15:45:44.000000000 +0200
+++ rootfs/etc/rc.d/init.d/network      2009-11-11 16:18:45.000000000 +0100
@@ -24,7 +24,9 @@
    #
    # set up the network interfaces
    #
-    if [ "$IPADDR0" = "" ]
+        ipaddr=`ifconfig eth0 | grep "\<inet addr\>" |\
+                sed -e "s/^.*\<inet addr:\([0-9.]*\) .*/\1/"`;
+    if [ "$IPADDR0" = "" ] && [ $ipaddr = "" ]
    then
        echo ""
        echo "Warning: no IPADDR is set, please set this from the ltib"


MATRIX VISION GmbH, Talstrasse 16, DE-71570 Oppenweiler
Registergericht: Amtsgericht Stuttgart, HRB 271090
Geschaeftsfuehrer: Gerhard Thullner, Werner Armingeon, Uwe Furtner, Hans-Joachim Reich


_______________________________________________
LTIB home page: http://ltib.org

Ltib mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/ltib





reply via email to

[Prev in Thread] Current Thread [Next in Thread]