Hi,
the pppd is horrible, but it is still usable :-) With introduction of
multiple routing tables the pppd is lacking the support of that stuff.
the most obvious thing is something like:
Index: sys-bsd.c
===================================================================
RCS file: /home/cyxob/cvs/src/usr.sbin/pppd/sys-bsd.c,v
retrieving revision 1.26
diff -u -p -r1.26 sys-bsd.c
--- sys-bsd.c 27 Oct 2009 23:59:53 -0000 1.26
+++ sys-bsd.c 28 Apr 2010 12:51:59 -0000
@@ -1129,6 +1129,7 @@ dodefaultroute(g, cmd)
rtmsg.hdr.rtm_version = RTM_VERSION;
rtmsg.hdr.rtm_seq = ++rtm_seq;
rtmsg.hdr.rtm_addrs = RTA_DST | RTA_GATEWAY | RTA_NETMASK;
+ rtmsg.hdr.rtm_tableid = getrdomain();
rtmsg.dst.sin_len = sizeof(rtmsg.dst);
rtmsg.dst.sin_family = AF_INET;
rtmsg.gway.sin_len = sizeof(rtmsg.gway);
This way at least "route -T 1 exec pppd" works as one could expect.
Then, the next thing is those scripts the pppd can launch: ip-up and
ip-down. In case there will be a need to make additional modifications
to the routing table, they will missbehave. I am not sure what is the
best way here.
The tableid could be passwd as additional parameter. In order not to
break the compatibility too badly, it could be the last one - the
seventh.
OTOH, iheritance of rdomain could be used.
The tableid is (if i am not mistaken) inherited as rdomain, so it
means ip-up script would inerit from pppd and if ip-up starts route(8)
it will inherit it too. All is nice, but route(8) does not pay
attention to its rdomain, it always uses 0 as default for route
operations and 1 (!) for exec. BTW the later is not reflected in the
man page.
So, route(8) could be changed so that it respected the inerited
rdomain. Off course it poses dangers of an operator having shell with
inherited rdomain X, and launching "route show" and being totaly
confused. To ease this dangers a warnx() could be added if tableid is
the inherited rdomain, it is not zero, no T and no q flags were used.
With route(8) respecting rdomain ip-up/ip-down scripts could just use
route and modify the routing table that was inherited from the pppd.
With -T it could be changed any time off course.
The other thing may be modification to T flag of route. For example, a
question mark instead of numeric value would be used to get tableid
from rdomain e.g. "route -T 1 exec route -T ? show"
I have some diffs. Is any one curious?
Thanks.