diff options
author | bz <bz@FreeBSD.org> | 2009-04-20 14:38:48 +0000 |
---|---|---|
committer | bz <bz@FreeBSD.org> | 2009-04-20 14:38:48 +0000 |
commit | ab7aea9843d0d2c703ba005eba637e7a49d9f753 (patch) | |
tree | 1b172c7715c6e39140b607524a21a7989e05b951 | |
parent | 24114749aa9a49d7dc6ab793a3cc29a66c23dac1 (diff) | |
download | FreeBSD-src-ab7aea9843d0d2c703ba005eba637e7a49d9f753.zip FreeBSD-src-ab7aea9843d0d2c703ba005eba637e7a49d9f753.tar.gz |
Conditionally add the interface name and address if available
so that a ppp running in `receiver' (server) mode can properly
update routes, for example to update the MTU.
Submitted by: loos.br gmail.com (Luiz Otavio O Souza)
PR: bin/130159
PR: kern/125079, kern/122068, bin/126892
MFC after: 3 days
-rw-r--r-- | usr.sbin/ppp/ipcp.c | 2 | ||||
-rw-r--r-- | usr.sbin/ppp/ipv6cp.c | 2 | ||||
-rw-r--r-- | usr.sbin/ppp/route.c | 13 | ||||
-rw-r--r-- | usr.sbin/ppp/route.h | 1 |
4 files changed, 14 insertions, 4 deletions
diff --git a/usr.sbin/ppp/ipcp.c b/usr.sbin/ppp/ipcp.c index 8991063..31aa07d 100644 --- a/usr.sbin/ppp/ipcp.c +++ b/usr.sbin/ppp/ipcp.c @@ -692,7 +692,7 @@ ipcp_SetIPaddress(struct ipcp *ipcp, struct in_addr myaddr, if (bundle->ncp.cfg.sendpipe > 0 || bundle->ncp.cfg.recvpipe > 0) { ncprange_getsa(&myrange, &ssgw, &ssmask); ncpaddr_getsa(&hisncpaddr, &ssdst); - rt_Update(bundle, sadst, sagw, samask); + rt_Update(bundle, sadst, sagw, samask, NULL, NULL); } if (Enabled(bundle, OPT_SROUTES)) diff --git a/usr.sbin/ppp/ipv6cp.c b/usr.sbin/ppp/ipv6cp.c index 06b003b..4557188 100644 --- a/usr.sbin/ppp/ipv6cp.c +++ b/usr.sbin/ppp/ipv6cp.c @@ -245,7 +245,7 @@ ipcp_SetIPv6address(struct ipv6cp *ipv6cp, u_char *myifid, u_char *hisifid) ncpaddr_getsa(&ipv6cp->hisaddr, &ssdst); else sadst = NULL; - rt_Update(bundle, sadst, sagw, samask); + rt_Update(bundle, sadst, sagw, samask, NULL, NULL); } if (Enabled(bundle, OPT_SROUTES)) diff --git a/usr.sbin/ppp/route.c b/usr.sbin/ppp/route.c index d55a06b..e7db97e 100644 --- a/usr.sbin/ppp/route.c +++ b/usr.sbin/ppp/route.c @@ -532,7 +532,8 @@ route_UpdateMTU(struct bundle *bundle) " mtu %lu\n", rtm->rtm_index, Index2Nam(rtm->rtm_index), ncprange_ntoa(&dst), bundle->iface->mtu); } - rt_Update(bundle, sa[RTAX_DST], sa[RTAX_GATEWAY], sa[RTAX_NETMASK]); + rt_Update(bundle, sa[RTAX_DST], sa[RTAX_GATEWAY], sa[RTAX_NETMASK], + sa[RTAX_IFP], sa[RTAX_IFA]); } } @@ -870,7 +871,8 @@ failed: void rt_Update(struct bundle *bundle, const struct sockaddr *dst, - const struct sockaddr *gw, const struct sockaddr *mask) + const struct sockaddr *gw, const struct sockaddr *mask, + const struct sockaddr *ifp, const struct sockaddr *ifa) { struct ncprange ncpdst; struct rtmsg rtmes; @@ -920,6 +922,13 @@ rt_Update(struct bundle *bundle, const struct sockaddr *dst, p += memcpy_roundup(p, mask, mask->sa_len); } + if (ifa && ifp && ifp->sa_family == AF_LINK) { + rtmes.m_rtm.rtm_addrs |= RTA_IFP; + p += memcpy_roundup(p, ifp, ifp->sa_len); + rtmes.m_rtm.rtm_addrs |= RTA_IFA; + p += memcpy_roundup(p, ifa, ifa->sa_len); + } + rtmes.m_rtm.rtm_msglen = p - (char *)&rtmes; wb = ID0write(s, &rtmes, rtmes.m_rtm.rtm_msglen); diff --git a/usr.sbin/ppp/route.h b/usr.sbin/ppp/route.h index edf6604..bb8bd38 100644 --- a/usr.sbin/ppp/route.h +++ b/usr.sbin/ppp/route.h @@ -70,4 +70,5 @@ extern void route_ParseHdr(struct rt_msghdr *, struct sockaddr *[RTAX_MAX]); extern int rt_Set(struct bundle *, int, const struct ncprange *, const struct ncpaddr *, int, int); extern void rt_Update(struct bundle *, const struct sockaddr *, + const struct sockaddr *, const struct sockaddr *, const struct sockaddr *, const struct sockaddr *); |