-/* $OpenBSD: ppp_tty.c,v 1.54 2022/01/02 22:36:04 jsg Exp $ */
+/* $OpenBSD: ppp_tty.c,v 1.55 2024/08/17 09:52:11 denis Exp $ */
/* $NetBSD: ppp_tty.c,v 1.12 1997/03/24 21:23:10 christos Exp $ */
/*
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);
}
-/* $OpenBSD: sys-bsd.c,v 1.35 2024/08/10 05:32:28 jsg Exp $ */
+/* $OpenBSD: sys-bsd.c,v 1.36 2024/08/17 09:52:11 denis Exp $ */
/*
* sys-bsd.c - System-dependent procedures for setting up
return 1;
}
+/*
+ * getrtableid - return routing table id of ppp interface
+ */
+int
+getrtableid(void)
+{
+ struct ifreq ifr;
+ int tableid = 0;
+
+ memset(&ifr, 0, sizeof(ifr));
+ strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
+ if (ioctl(sockfd, SIOCGIFRDOMAIN, (caddr_t) &ifr) == 0)
+ tableid = ifr.ifr_rdomainid;
+
+ return tableid;
+}
+
/*
* sifdefaultroute - assign a default route through the address given.
*/
rtmsg.hdr.rtm_type = cmd == 's'? RTM_ADD: RTM_DELETE;
rtmsg.hdr.rtm_flags = RTF_UP | RTF_GATEWAY;
rtmsg.hdr.rtm_version = RTM_VERSION;
+ rtmsg.hdr.rtm_tableid = getrtableid();
rtmsg.hdr.rtm_seq = ++rtm_seq;
rtmsg.hdr.rtm_addrs = RTA_DST | RTA_GATEWAY | RTA_NETMASK;
rtmsg.dst.sin_len = sizeof(rtmsg.dst);