Mando algo que me habia quedado colgado en el outbox, una forma simple
de chequear dhcp servers con udhcpc
On 07/14/2013 03:34 PM, Gioacchino Mazzurco wrote:
On Tuesday, July 09, 2013 08:23:34 PM Pau wrote:
Could be useful for us? It can be executed to
know if there are DHCP
servers (different to you) in a network interface.
(08:20:49 PM) mrkiko: the problem is ethernet - how is it possible to
check if ethernet connectivity is actually available in an event-based
way? So, since ifup implies ifdown and then ifup, I was thinking to try
to ifup the interface and verify with ifstatus if things gone well
(08:21:26 PM) jow_laptop: you want to chack ethernet availability
without actually bring the interface up? like a dry-run?
(08:21:31 PM) jow_laptop: s/chack/check/
(08:21:52 PM) mrkiko: yes
(08:21:56 PM) mrkiko: exactly that
(08:22:36 PM) mrkiko: I might also manage to do it by hand - with the ip
command and ping... but I would not be so happy :)
(08:22:38 PM) jow_laptop: udhcpc -n -q -s /bin/true -t 1 -i eth1
/dev/null && echo "there is dhcp" ||
echo "there is no dhcp"
(08:22:56 PM) mrkiko: ah
(08:23:23 PM) mrkiko: yeah - you changed my day - for the second time
(08:23:32 PM) jow_laptop: the trick is to invoke udhcpc with a dummy
script (/bin/true) that does simply nothing with the received lease
(08:23:43 PM) mrkiko: I looked ad udhcp help various times without noticing
(08:25:08 PM) jow_laptop: you might need to ifconfig eth1 up / ip link
set dev eth1 up before calling udhcpc
(08:25:13 PM) jow_laptop: not sure if it does it by itself
(08:25:48 PM) mrkiko: Infact I need to do so
(08:25:52 PM) mrkiko: and I will :)
(08:25:56 PM) jow_laptop: also a larger timeout etc.
(08:26:04 PM) jow_laptop: not any dhcp server might be that fast
I didn't take a look at code but as i said in the
past the idea seems useful
;)
_______________________________________________
Dev mailing list
Dev(a)lists.libre-mesh.org
https://lists.libre-mesh.org/mailman/listinfo/dev