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
This commit is contained in:
parent
f4ffd67c18
commit
0e81959d3a
@ -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))
|
||||
|
@ -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))
|
||||
|
@ -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);
|
||||
|
@ -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 *);
|
||||
|
Loading…
x
Reference in New Issue
Block a user