[19. April 2013] A-400 Advanced Network Setup now available | [11 Jan. 2013] Customize your A-400 Home Screen

Firmware: A-400 [13 May 2013] | C-300 [30 Nov. 2012] | A-300 [30 Nov. 2012] | C-200 [21 Jan. 2013] | A-200/A-210 [10 Aug. 2012]

Just got your NMT | WIKI has the answers | Search the forum | Forum Rules/Policy | Firmware & Official NMT News | Popcornhour manuals



User(s) browsing this thread: 1 Guest(s)
Thread Closed 
DHCP client does not send hostname
04-07-2008, 08:53 AM
Post: #1
DHCP client does not send hostname
My DD-wrt router shows the hostname of the popcorn hour as * rather than pch-a100. I've looked in the init.d/S40network script and it looks like the hostname is not set in the do_netconfig() script. The following commands need to be added to the do_netconfig() script:


net_hostname=`/bin/pflash get hostname`

echo "iface $interface inet dhcp" >> $net_config
echo -e "\thostname $net_hostname" >> $net_config



I tried adding the changes myself, but the /etc directory is on the ramdisk and it gets re-written when I reboot.

-Scott

I'm using the latest released versions of the firmware.
Find all posts by this user
08-03-2009, 09:40 PM (This post was last modified: 08-03-2009 09:41 PM by chrmhoffmann.)
Post: #2
RE: DHCP client does not send hostname
Hi,

anybody found a solution to this problem? It's a bit annoying to make a fixed dhcp rule.

Chris
Find all posts by this user
08-03-2009, 10:38 PM
Post: #3
RE: DHCP client does not send hostname
The OP was written over a year ago. Looking at the current /etc/init.d/S40network script on my A-100 it appears it has changed, but there's still no sign of the hostname!?

I could be wrong though (I'm far from an expert on this field too Wink )
Perhaps a real *nix skilled person could verify how it works, and should work?

The current S40network script on my A-100:
Code:
# cat S40network
#!/bin/sh
#
# Start the network....
#

net_config=/etc/network/interfaces
dns_config=/etc/resolv.conf
wlan_config=/opt/wifi/config/wifi.config
wpa_config=/opt/wifi/config/wpa_supplicant.conf
net_interface=""
is_wireless="0"
is_dhcp="0"

net_generate_wlan_config()
{
        ssid=`/bin/pflash get wlan_ssid`
        security=`/bin/pflash get wlan_security`
        key=`/bin/pflash get wlan_securitykey`

        if [ -z $ssid ]; then
                echo "Error: SSID missing! Stop configuring network!"
                exit 1
        fi

        echo -e "ctrl_interface=/opt/wifi/config/wpa_supplicant\n" > $wpa_config
        echo "network={" >> $wpa_config
        echo "  ssid=\"$ssid\"" >> $wpa_config

        case $security in
                wep_40_a | wep_40_h | wep_108_a | wep_108_h)
                        echo "  key_mgmt=NONE" >> $wpa_config
                        if [ $security = "wep_40_a" -o $security = "wep_108_a" ]; then
                                echo "  wep_key0=\"$key\"" >> $wpa_config
                        else
                                echo "  wep_key0=$key" >> $wpa_config
                        fi
                        echo "  wep_tx_keyidx=0" >> $wpa_config
                        ;;
                wpa_tkip | wpa_ccmp | wpa_tkipccmp)
                        echo "  key_mgmt=WPA-PSK" >> $wpa_config
                        echo "  proto=WPA" >> $wpa_config
                        if [ $security = "wpa_tkip" ]; then
                                echo "  pairwise=TKIP" >> $wpa_config
                                echo "  group=TKIP" >> $wpa_config
                        elif [ $security = "wpa_ccmp" ]; then
                                echo "  pairwise=CCMP" >> $wpa_config
                                echo "  group=CCMP" >> $wpa_config
                        else
                                echo "  pairwise=CCMP TKIP" >> $wpa_config
                                echo "  group=CCMP TKIP" >> $wpa_config
                        fi
                        echo "  psk=\"$key\"" >> $wpa_config
                        ;;
                wpa2_tkip | wpa2_ccmp | wpa2_tkipccmp)
                        echo "  key_mgmt=WPA-PSK" >> $wpa_config
                        echo "  proto=RSN" >> $wpa_config
                        if [ $security = "wpa2_tkip" ]; then
                                echo "  pairwise=TKIP" >> $wpa_config
                                echo "  group=TKIP" >> $wpa_config
                        elif [ $security = "wpa2_ccmp" ]; then
                                echo "  pairwise=CCMP" >> $wpa_config
                                echo "  group=CCMP" >> $wpa_config
                        else
                                echo "  pairwise=CCMP TKIP" >> $wpa_config
                                echo "  group=CCMP TKIP" >> $wpa_config
                        fi
                        echo "  psk=\"$key\"" >> $wpa_config
                        ;;
                *)
                        echo "  key_mgmt=NONE" >> $wpa_config
                        ;;
        esac

        echo "  scan_ssid=1" >> $wpa_config
        echo "}" >> $wpa_config
}

net_config_eth()
{
        net_interface="eth0"
}

net_config_wlan()
{

        if [ ! -e $wlan_config ]; then
                echo "No wifi device found! Stop configuring network!"
                exit 1
        fi

        net_interface="wlan0"
        wifi_device=`cat $wlan_config | grep net.wifi.device | cut -d= -f 2`
        wifi_driver="wext"

        if [ $wifi_device = "usb_zd1221" ]; then
                /opt/wifi/zd1221/zd1221.sh
                wifi_driver="otus"
        elif [ $wifi_device = "pci_mtlk" ]; then
                /opt/wifi/mtlk/mtlk.sh
        elif [ $wifi_device = "pci_rt2880" ]; then
                /opt/wifi/rt2880/rt2880.sh
                wifi_driver="ralink"
        fi

        net_generate_wlan_config

        /opt/wifi/bin/wpa_supplicant -B -D$wifi_driver -i$net_interface -c$wpa_config
}

net_config_interface() {
        is_wireless=`/bin/pflash get wireless`
        if [ $is_wireless = "1" ]; then
                net_config_wlan
        else
                net_config_eth
        fi
}

net_generate_config()
{
        is_dhcp=`/bin/pflash get dhcp`
        echo "auto lo" > $net_config
        echo "iface lo inet loopback" >> $net_config
        echo -e "\n" >> $net_config

        echo "auto $net_interface" >> $net_config
        if [ $is_dhcp = "0" ]; then
                ipaddr=`/bin/pflash get eth_ipaddr`
                netmask=`/bin/pflash get eth_netmask`
                dns=`/bin/pflash get eth_dns`
                dns2=`/bin/pflash get eth_dns2`
                gateway=`/bin/pflash get eth_gateway`

                if [ -z $ipaddr ]; then
                        echo "Error: IP address missing! Stop configuring network!"
                        exit 1
                fi

                if [ -z $netmask ]; then
                        echo "Error: Subnet mask missing! Stop configuring network!"
                        exit 1
                fi

                echo "iface $net_interface inet static" >> $net_config
                echo -e "\taddress $ipaddr" >> $net_config
                echo -e "\tnetmask $netmask" >> $net_config

                if [ ! -z $gateway ]; then
                        echo -e "\tgateway $gateway" >> $net_config
                fi

                if [ ! -z $dns ]; then
                        echo "nameserver $dns" > $dns_config
                fi

                if [ ! -z $dns2 ]; then
                        echo "nameserver $dns2" >> $dns_config
                fi
        else
                echo "iface $net_interface inet dhcp" >> $net_config
        fi
}

wait_wlan_up()
{
        timeout=30
        if [ $is_wireless = "1" ]; then
                while ! `/opt/wifi/bin/wpa_cli -p /opt/wifi/config/wpa_supplicant -i $net_interface status | grep -q "COMPLETED"`; do
                        sleep 1
                        timeout=$((timeout-1))
                        #echo -e "Current timeout is $timeout\n"
                        if [ $timeout = 0 ]; then
                                break;
                        fi
                done
        fi
}

net_deconfig()
{
        if grep -q eth0 /etc/network/interfaces; then
                interface="eth0"
        else
                interface="wlan0"
                wifi_device=`cat $wlan_config | grep net.wifi.device | cut -d= -f 2`
                /opt/wifi/bin/wpa_cli -p /opt/wifi/config/wpa_supplicant -i $interface terminate
                if [ $wifi_device = "pci_rt2880" ]; then
                        sleep 1
                fi
        fi

        ifdown $interface
}

start()
{
        echo "Starting network..."
        net_config_interface
        net_generate_config
        if [ $is_wireless = "1" ]; then
                wait_wlan_up
        fi
        /sbin/ifup -a
        #if [ $is_wireless = "1" -a $is_dhcp = "0" ]; then /*[20081013] 06:26P kllay, update ip in network html*/
        if [ $is_dhcp = "0" ]; then
                /bin/ipmonitor reset    # re-generate setup page
        fi
}

stop()
{
        echo "Stopping network..."
        net_deconfig
}

restart()
{
        stop
        start
}

shutdown()
{
        stop
        ifconfig eth0 down
        if [ -e $wlan_config ]; then
                ifconfig wlan0 down
        fi
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart|reload)
        restart
        ;;
  shutdown)
        shutdown
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart}"
        exit 1
esac

exit

Audio, video, disco - I hear, I see, I learn.
Wiki. Wiki? Wiki!
Find all posts by this user
Thread Closed 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  [Bug] UPnP client should not send SSDP requests from port 1900 Ivan Mironov 0 2,186 06-25-2011 12:54 AM
Last Post: Ivan Mironov
  Unable to resolve the hostname Normi 1 1,864 05-03-2011 06:48 PM
Last Post: Pain
Information DHCP Server skinnyPete 1 1,255 06-09-2010 09:16 PM
Last Post: johnpoz
  DHCP client not sending hostname Youx 8 4,318 05-18-2010 05:58 PM
Last Post: nuke12
  How can we disable uPnP client in Popcorn ? gcpc 22 9,775 11-05-2009 10:16 PM
Last Post: MikeMcr
  MMS:// streaming client - PLEASE! JaixBly 75 24,795 11-03-2009 10:36 AM
Last Post: wvn
  Feature Request: simple pop3 e-mail client Falk 4 2,173 04-26-2009 12:37 PM
Last Post: simonantonanton
  Feature Request Re: DHCP nuke12 0 877 04-20-2009 09:07 AM
Last Post: nuke12
  OneSwarm client foffen 2 1,816 03-31-2009 10:43 PM
Last Post: sajmonl
  edonkey/emule client tiwas 0 815 03-02-2009 01:19 AM
Last Post: tiwas

Forum Jump: