SliTaz SliTaz Forum

You are not logged in.

#1 2013-01-12 22:06:05

ernia
Member
Registered: 2011-05-20
Posts: 299

rolling: proposed patch for /etc/init.d/network.sh

i think that the udhcpc command in network.sh does not send hostname in the lease request, so it's not possible to ping a slitaz machine by name but only by ip  address (at least in my network where server runs dnsmasq).

the fix would be to add the correct option to the udhcpc command:

[c]--- /etc/init.d/network.sh
+++ /home/fabio/network.sh
@@ -152,7 +152,8 @@
            wpa
        else # fallback on udhcpc: wep, eth
            /sbin/udhcpc -b -T 1 -A 12 -i $INTERFACE -p \
-            /var/run/udhcpc.$INTERFACE.pid
+            /var/run/udhcpc.$INTERFACE.pid \
+            -x hostname:"$(hostname)"
        fi
    fi
}[/c]
it wouldn't work in 4.0, it would be -h $(hostname)

ping results and arp table in my server, first and after the mod, being slitvaio already modded:

[c]root@nano:/home/fabio# ping slitazserver
ping: unknown host slitazserver
root@nano:/home/fabio# arp
Address                  HWtype  HWaddress           Flags Mask            Iface
Aspi                     ether   c8:9c:dc:bf:59:5f   C                     eth0
192.168.1.1              ether   1c:bd:b9:81:cc:c0   C                     eth1
192.168.0.129            ether   08:00:27:1d:83:1c   C                     eth0
slitvaio                 ether   54:42:49:a2:22:ff   C                     eth0
root@nano:/home/fabio# arp
Address                  HWtype  HWaddress           Flags Mask            Iface
Aspi                     ether   c8:9c:dc:bf:59:5f   C                     eth0
192.168.1.1              ether   1c:bd:b9:81:cc:c0   C                     eth1
slitazserver             ether   08:00:27:1d:83:1c   C                     eth0
slitvaio                 ether   54:42:49:a2:22:ff   C                     eth0
root@nano:/home/fabio# ping slitazserver
PING slitazserver (192.168.0.129) 56(84) bytes of data.
64 bytes from slitazserver (192.168.0.129): icmp_req=1 ttl=64 time=4.14 ms
64 bytes from slitazserver (192.168.0.129): icmp_req=2 ttl=64 time=0.549 ms
64 bytes from slitazserver (192.168.0.129): icmp_req=3 ttl=64 time=0.501 ms
^C
--- slitazserver ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 0.501/1.732/4.147/1.707 ms[/c]
i don't think that this could break something and it's useful in a simple slitaz pc network.

could it be pushed?

thanks

Offline

#2 2013-01-12 23:05:40

ernia
Member
Registered: 2011-05-20
Posts: 299

Re: rolling: proposed patch for /etc/init.d/network.sh

tested with 4.0 in a live cd, it works too.

busybox 1.20.2 dropped the -H -h --hostname option, but -x OPT:VAL is present from 1.17 , so the patch works in stable too.

Offline

#3 2013-01-13 08:37:31

mojo
Administrator
Registered: 2011-03-29
Posts: 2,174

Re: rolling: proposed patch for /etc/init.d/network.sh

tux@slitaz:~/repos/slitaz-boot-scripts$ hg push

pushing to http://hg.slitaz.org/slitaz-boot-scripts

searching for changes

http authorization required

realm: SliTaz Mercurial repositories

user: mojo

password:

abort: authorization failed

Pankso or Erjo can push it if we can get their attention.

Offline

#4 2013-01-13 10:24:15

ernia
Member
Registered: 2011-05-20
Posts: 299

Re: rolling: proposed patch for /etc/init.d/network.sh

how loud should i shout? :-)

Offline

#5 2013-01-13 13:26:22

lexeii
Administrator
Registered: 2012-03-21
Posts: 1,853

Re: rolling: proposed patch for /etc/init.d/network.sh

ernia,

You have a lot of ideas, bugfixes and improvements.

You should get write access to Hg. Ask main developers in the mailing list, or in private msg.

Learn base using of Hg.

Improve Hg stuff directly.

And not shout more wink

Offline

#6 2013-01-13 15:42:00

ernia
Member
Registered: 2011-05-20
Posts: 299

Re: rolling: proposed patch for /etc/init.d/network.sh

i would be glad to contribute, even if i'm not a dev but only a slitaz enthusiast.

devs better makes me an account if they don't want me shout anymore :-)

i'll start to study how hg works and when i'll feel ready i'll ask for an account.

if allowed i'll contribute as i can.

thank you for your kind answer.

Offline

#7 2013-01-13 18:10:07

kultex
Administrator
Registered: 2011-03-28
Posts: 1,175

Re: rolling: proposed patch for /etc/init.d/network.sh

really good idea to give ernia access to Hg

and if somebody changes something in network.sh - I have a whish

I need for my next SliTaz-OLA release that it boots to a fix IP, if there is no dhcp lease. I think, that could be also included in SliTaz 5.0

It should work quite easy, because when you set both "DHCP" and "STATIC"  = "yes" in netwok.conf - it gets first a dhcp adress, but this is overwritten later on by the static IP.

so the only thing is to change something in network.sh

# For a static IP.

static_ip() {

        if [ "STATIC"="yes" ] ; then

now it must just ask, if ifconfig has already a value - if yes finished, if no continue

I think we can use grep -c for that, which return 1 if an adress is

found or 0 if not. Like:

ifconfig $interface | grep -c "inet addr"

Offline

#8 2013-01-17 16:51:06

ernia
Member
Registered: 2011-05-20
Posts: 299

Re: rolling: proposed patch for /etc/init.d/network.sh

@kultex

your wish has been fullfilled:

http://hg.slitaz.org/slitaz-boot-scripts/rev/b53e5c0a9026

http://hg.slitaz.org/slitaz-boot-scripts/rev/f74f7daf1ed4

mine not :-(

:-)

i don't think i'm ready to push directly, better post here and let my patch be examined by devs ;-)

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.016 seconds, 7 queries executed - Memory usage: 1.55 MiB (Peak: 1.77 MiB) ]