Hi,
i wish to share a simple patch to bypass the problem showed in my previous mail.
the patch fix 2 problems:
1- with the original "/sbin/dhclient-script"  you don't get the
default gateway if it is
on a different subnet then your IP.

2- when you put down the interface with "ifconfig rl0 down" and then you
rerun "dhclient rl0" , you don't get the IP configured and with a
little of debug i
found the the dhclient-script execute:
ifconfig rl0 inet 84.223.120.116 netmask 255.255.255.255 broadcast
84.223.120.116
ifconfig: SIOCAIFADDR: File exists

the problem is that you have a route that conflict with the command:
84.223.120.116/32  link#3             UC          0        0      -   rl0

the route is added the first time and didn't get deleted on a FAIL event
(the env is not set by dhclient, i don't know why).
the second time you run "dhclient rl0" the old_IP and the new_IP is
the same and so
the  delete_old_routes is not executed.
i corrected the problem commenting out the line:
route add $new_ip_address 127.0.0.1 >/dev/null 2>&1

since when you normally configure a static IP address you don't
configure such route
(please if you know a reason to leave this route let me know).

here the patch to /sbin/dhclient-script:

# diff -u /sbin/dhclient-script  dhclient-script.patched
--- /sbin/dhclient-script       Sun Mar 11 02:39:21 2007
+++ dhclient-script.patched     Mon May 28 22:48:25 2007
@@ -37,7 +37,7 @@
               $medium

       # XXX Original TIMEOUT code did not do this unless $new_routers was set?
-       route add $new_ip_address 127.0.0.1 >/dev/null 2>&1
+       #route add $new_ip_address 127.0.0.1 >/dev/null 2>&1
}

delete_old_alias() {
@@ -76,6 +76,9 @@
       for router in $new_routers; do
               if [ "$new_ip_address" = "$router" ]; then
                       route add default -iface $router >/dev/null 2>&1
+               elif [ "$new_subnet_mask" = "255.255.255.255" ]; then
+                       route add -host $router -interface -link
$interface -expire 1 >> /tmp/dhcp.log
+                       route add default $router >> /tmp/dhcp.log
               else
                       route add default $router >/dev/null 2>&1
               fi

EOF


regards
Luigi


On 5/22/07, Luigi Tarenga <[EMAIL PROTECTED]> wrote:
hi all,
i have an Adsl internet connection with the tiscali provider
and i just solved my problem of getting the IP address on my openbsd machine.
i wish to share my experience here, feel free to correct my english :P
[...snip...]
you can try without the 2 "route add"  command if it works, i had to use them
because the gateway is on a different subnet of my public IP and the dhclient
command doesn't configure it automatically (anyone know another
solution to this?).

Reply via email to