Bugs item #681864, was opened at 2003-02-06 12:17
Message generated for change (Comment added) made by dannf
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=100259&aid=681864&group_id=259

Category: systemimager-client
Group: None
Status: Open
>Resolution: Wont Fix
Priority: 5
Submitted By: Randall Splinter (rxspl1)
Assigned to: Nobody/Anonymous (nobody)
Summary: MS DHCP Server returns SI server IP as hex

Initial Comment:

At boot time the client requests an IP address from 
a MS Win2000 DHCP server. The DHCP server 
complies and sends an IP address. The DHCP server 
also sends the option-140 to pass the SI server IP 
address to the client. The SI server IP address 
passed to the client is sent as a hex not decimal. 
Is there any to make a more intelligent client that 
recognizes a hex IP address and converts it to 
decimal so that the install can proceed? 

The IP address of the SI server is 192.168.168.15 
and the client receives the address c0:a8:a8:f 
from the DHCP server. Attached is a poor screen 
shot taken with a digital camera of what is 
happening. I can probably do better if it is needed 
to help debug the problem.

----------------------------------------------------------------------

>Comment By: dann frazier (dannf)
Date: 2004-01-07 23:49

Message:
Logged In: YES 
user_id=146718

it seems that this isn't necessary - a windows server can be
configured to do the right thing. 
Randy - can you elaborate on how to do this?  i'll add it to
the faq.

----------------------------------------------------------------------

Comment By: dann frazier (dannf)
Date: 2003-02-12 01:59

Message:
Logged In: YES 
user_id=146718

Randy: here's some other changes i made, fyi.
i haven't actually added the code to do the conversions for
specific IPs yet, but you would just need to do something like:
IMAGESERVER=$(dehex_ip $IMAGESERVER)

--- initrd_source/initrd.rul    9 Jan 2003 06:56:04 -0000  
    1.16.4.2
+++ initrd_source/initrd.rul    12 Feb 2003 08:47:36 -0000
@@ -65,7 +65,7 @@ $(INITRD_DIR)/build_dir-stamp:       
$(SKEL_FI
                                $(DEVFSD_BINARY)
$(DHCLIENT_BINARY)                                 $(RSYNC_BINARY)
$(UCLIBC_TARGET)                                 $(INSMOD_BINARY)
$(MODPROBE_BINARY) -                               $(E1000_BINARY)
+                               $(E1000_BINARY) $(BC_BINARY)
        # Create directory structure.
        rm -fr $(INITRD_BUILD_DIR)
        mkdir $(INITRD_BUILD_DIR)
@@ -80,6 +80,7 @@ $(INITRD_DIR)/build_dir-stamp:       
$(SKEL_FI
 
        # Copy over other binaries.
        cp -a $(RSYNC_BINARY) $(INITRD_BUILD_DIR)/bin
+       cp -a $(BC_BINARY) $(INITRD_BUILD_DIR)/bin
        cp -a $(DHCLIENT_BINARY) $(INITRD_BUILD_DIR)/sbin
        cp -a $(DEVFSD_BINARY) $(INITRD_BUILD_DIR)/sbin
diff -u -p -u -r1.1 busybox.Config.h.noinsmod
--- initrd_source/patches/busybox.Config.h.noinsmod     14
Oct 2002 15:26:55 -0000      1.1
+++ initrd_source/patches/busybox.Config.h.noinsmod     12
Feb 2003 08:47:36 -0000
@@ -120,7 +120,7 @@
 //#define BB_TFTP
 //#define BB_TIME
 //#define BB_TOUCH
-//#define BB_TR
+#define BB_TR
 //#define BB_TRACEROUTE
 //#define BB_TRUE_FALSE
 //#define BB_TTY
diff -u -p -u -r1.36.4.1 rcS
--- initrd_source/skel/etc/init.d/rcS   21 Dec 2002 23:16:55
-0000      1.36.4.1+++ initrd_source/skel/etc/init.d/rcS  
12 Feb 2003 08:47:37 -0000
@@ -56,6 +56,29 @@ adjust_arch() {
     fi
 }
 
+#################################################################################
+#  dehex_ip
+#
+#  takes an ip address, in either decimal or hexadecimal
form (which MS DHCP
+#  servers provide), and returns the decimal form.  
+#
+################################################################################
+
+dehex_ip() {
+    local hex dec myip="" decimal=""
+
+    if echo "$1" | grep -q ":"; then
+        for hex in $(echo $1 | sed 's/:/ /g' | tr [a-z]
[A-Z]); do
+            dec=$(echo -e "obase=10\nibase=16\n${hex}" | bc)
+            myip="${myip}${decimal}${dec}"
+           decimal="."
+        done
+    else
+        myip=$1
+    fi
+    echo "$myip"
+}
+
 write_variables() {
     # pass all variables set here on to the hostname.sh script
     rm -f /tmp/variables.txt
--------
and my new initrd_source/make.d/bc.rul:
BC_VERSION := 1.06
BC_DIR := bc-$(BC_VERSION)
BC_TARBALL := bc-$(BC_VERSION).tar.gz
BC_URL := http://download.systemimager.org/pub/bc/$(BC_TARBALL)
BC_BINARY := $(INITRD_SRC_DIR)/$(BC_DIR)/bc/bc

ALL_SOURCE += $(INITRD_SRC_DIR)/$(BC_TARBALL)

PHONY += bc
bc:     $(BC_BINARY)
$(BC_BINARY):   $(INITRD_SRC_DIR)/$(BC_TARBALL)
        [ -d $(INITRD_SRC_DIR)/$(BC_DIR) ] || ( cd
$(INITRD_SRC_DIR) && tar -xvzf $(BC_TARBALL) )
        ( cd $(INITRD_SRC_DIR)/$(BC_DIR) && CFLAGS=-Os ./configure )
        $(MAKE) -C $(INITRD_SRC_DIR)/$(BC_DIR)
PATH=$(INITRD_BUILD_PATH)

$(INITRD_SRC_DIR)/$(BC_TARBALL):
        [ -d $(INITRD_SRC_DIR) ] || mkdir -p $(INITRD_SRC_DIR)
        $(GETSOURCE) $(BC_URL) $(INITRD_SRC_DIR)

PHONY += bc_clean
bc_clean:
        rm -rf $(INITRD_SRC_DIR)/$(BC_DIR)


----------------------------------------------------------------------

Comment By: dann frazier (dannf)
Date: 2003-02-12 01:49

Message:
Logged In: YES 
user_id=146718

well, the big problems w/ my script are that we don't have
tr, cut,
or bc in the ramdisk.

ok - i can live without cut, but dunno how to get along w/o
bc or tr.

adding full blown bc + tr affects the initrd.img size like so:
base = 532349
base + busybox tr = 533255
base + busybox tr + bc = 562891
base + busybox tr + bc (built w/ -Os) = 560311

we're looking at an additional 27KB.

here's an updated snippet, as a function (tested in busybox
shell)

dehex_ip() {
    local hex dec myip="" decimal=""

    if echo "$1" | grep -q ":"; then
                for hex in $(echo $1 | sed 's/:/ /g' | tr [a-z]
[A-Z]); do
            dec=$(echo -e "obase=10\nibase=16\n${hex}" | bc)
            myip="${myip}${decimal}${dec}"
            decimal="."
        done
    else
        myip=$1
    fi
    echo "$myip"
}


----------------------------------------------------------------------

Comment By: dann frazier (dannf)
Date: 2003-02-08 03:12

Message:
Logged In: YES 
user_id=146718

here's some shell that'll do this:
#!/bin/sh

IP="c0:a8:a8:f"
MYIP=""

if echo "$IP" | grep -q ":"; then
    decimal=""
    for i in $(seq 1 4); do
        hex=$(echo $IP | cut -d ":" -f $i | tr [a-z] [A-Z])
        dec=$(echo -e "obase=10\nibase=16\n${hex}" | bc)
        MYIP="${MYIP}${decimal}${dec}"
        decimal="."
    done
else
    MYIP=$IP
fi

echo MYIP is $MYIP


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=100259&aid=681864&group_id=259


-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Sisuite-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/sisuite-devel

Reply via email to