Download raw body.
pppd(8): add support for rdomain
Le Mon, Jul 08, 2024 at 10:15:02PM +0200, Claudio Jeker a écrit : > On Mon, Jul 08, 2024 at 08:51:16PM +0200, Denis Fondras wrote: > > Now, we can run the PPP interface in an rdomain and get a default route > > installed. > > > > Here is an improved version compared to yesterday's diff, fixing the warning > > message about mismatch on rdomain. > > > > ``` > > # ifconfig ppp0 rdomain 5 up > > # ifconfig em0 192.168.8.2/30 up > > # route add 10.42.0.240 192.168.8.1 > > # rcctl start xl2tpd > > # echo c l2tp > /var/run/xl2tpd/l2tp-control > > > > $ ping -V5 8.8.8.8 > > PING 8.8.8.8 (8.8.8.8): 56 data bytes > > 64 bytes from 8.8.8.8: icmp_seq=0 ttl=119 time=71.606 ms > > 64 bytes from 8.8.8.8: icmp_seq=1 ttl=119 time=64.730 ms > > ``` > > > > OK ? > > > > Index: sys/net/ppp_tty.c > > =================================================================== > > RCS file: /cvs/src/sys/net/ppp_tty.c,v > > diff -u -p -r1.54 ppp_tty.c > > --- sys/net/ppp_tty.c 2 Jan 2022 22:36:04 -0000 1.54 > > +++ sys/net/ppp_tty.c 30 Jun 2024 15:43:19 -0000 > > @@ -371,6 +371,7 @@ pppwrite(struct tty *tp, struct uio *uio > > bcopy(mtod(m0, u_char *), dst.sa_data, PPP_HDRLEN); > > m0->m_data += PPP_HDRLEN; > > m0->m_len -= PPP_HDRLEN; > > + m0->m_pkthdr.ph_rtableid = sc->sc_if.if_rdomain; > > return sc->sc_if.if_output(&sc->sc_if, m0, &dst, NULL); > > } > > > > Index: usr.sbin/pppd/sys-bsd.c > > =================================================================== > > RCS file: /cvs/src/usr.sbin/pppd/sys-bsd.c,v > > diff -u -p -r1.33 sys-bsd.c > > --- usr.sbin/pppd/sys-bsd.c 19 Feb 2024 16:39:03 -0000 1.33 > > +++ usr.sbin/pppd/sys-bsd.c 30 Jun 2024 15:43:21 -0000 > > @@ -118,6 +118,7 @@ static int initdisc = -1; /* Initial TTY > > static int initfdflags = -1; /* Initial file descriptor flags for ppp_fd */ > > static int ppp_fd = -1; /* fd which is set to PPP discipline */ > > static int rtm_seq; > > +static int rtableid; > > This global feels wrong to me. Why is it needed? Can't dodefaultroute() > take the ifp->if_rdomain value? > There is no such ifp readily available from dodefaultroute(). Do I have to replicate what ppp_available() does ? It does not feel right either :/
pppd(8): add support for rdomain