El 5 d’abril de 2012 14:25, Michael Tokarev <[email protected]> ha escrit: >> You can't archieve compatible CLI among net-tools/Linux route and >> FreeBSD route. They were never meant to be compatible. All existing >> portable DHCP clients adapt to this and ship separate setup scripts >> for each platform. > > And this is a pity really, because the difference is actually > very small, at least in the basic syntax.
That's only the tip of the iceberg. From FreeBSD route(8) manpage: The route utility supports a limited number of general options, but a rich command language, enabling the user to specify any arbitrary request that could be delivered via the programmatic interface discussed in route(4). > What I'm unsure about is why dhcpc script is ready to > see "$route" being several words. It makes very little > sense even on linux, since only lowest-metric route will > be used anyway, and the rest will be ignored. But I've > no idea if "$route" variable from dhcpc can have >1 word. > > This is unrelated to this freebsd/linux difference, but > since the changes are in the same area I just tried to > understand where this multiple-routes code in the script > comes from. Digging further... ;) Uhm sorry, I've got no idea about that. > --- a/debian/tree/udhcpc/etc/udhcpc/default.script > +++ b/debian/tree/udhcpc/etc/udhcpc/default.script > @@ -15,13 +15,23 @@ case $1 in > > if [ -n "$router" ]; then > echo "$0: Resetting default routes" > - while /sbin/route del default gw 0.0.0.0 dev $interface; do :; > done > - > - metric=0 > - for i in $router; do > - /sbin/route add default gw $i dev $interface metric $metric > - metric=$(($metric + 1)) > - done > + case $(uname) in > + *FreeBSD*) # kFreeBSD route uses different location & syntax > + /lib/freebsd/route del default > + set -- $route #XXX can we have >1 route? > + /lib/freebsd/route add default $1 > + ;; > + *) > + #XXX should we delete any route or only device-specific? > + while /sbin/route del default dev $interface > + do :; done > + m=0 > + for i in $router; do #XXX can we have >1 route? > + /sbin/route add default gw $i dev $interface metric $m > + m=$(($m+1)) > + done > + ;; > + esac > fi Do you need me to test this? -- Robert Millan -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected] Archive: http://lists.debian.org/caofdtxovwfagbdn8xjib+3c-glr5aydbzes_x269ykv4tyh...@mail.gmail.com

