-/* $OpenBSD: route.c,v 1.309 2016/06/14 09:48:52 mpi Exp $ */
+/* $OpenBSD: route.c,v 1.310 2016/07/11 09:23:06 mpi Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
struct pool rttimer_pool; /* pool for rttimer structures */
void rt_timer_init(void);
-int rt_setaddr(struct rtentry *, struct sockaddr *);
int rtflushclone1(struct rtentry *, void *, u_int);
void rtflushclone(unsigned int, struct rtentry *);
int rt_if_remove_rtdelete(struct rtentry *, void *, u_int);
if (rt->rt_flags & RTF_MPLS)
free(rt->rt_llinfo, M_TEMP, sizeof(struct rt_mpls));
#endif
- free(rt->rt_addr, M_RTABLE, ROUNDUP(rt->rt_addr->sa_len));
free(rt->rt_gateway, M_RTABLE, ROUNDUP(rt->rt_gateway->sa_len));
free(rt_key(rt), M_RTABLE, rt_key(rt)->sa_len);
KERNEL_UNLOCK();
ifp = if_get(rt->rt_ifidx);
if (ifp != NULL) {
info.rti_info[RTAX_IFP] = sdltosa(ifp->if_sadl);
- info.rti_info[RTAX_IFA] = rt->rt_addr;
+ info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
}
rt_missmsg(cmd, &info, rt->rt_flags, rt->rt_priority, rt->rt_ifidx, 0,
* will get the new address and interface later.
*/
info->rti_ifa = NULL;
- info->rti_info[RTAX_IFA] = rt->rt_addr;
+ info->rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
}
info->rti_flags = rt->rt_flags | (RTF_CLONED|RTF_HOST);
* the routing table because the radix MPATH code use
* it to (re)order routes.
*/
- if ((error = rt_setaddr(rt, ifa->ifa_addr)) ||
- (error = rt_setgate(rt, info->rti_info[RTAX_GATEWAY]))) {
+ if ((error = rt_setgate(rt, info->rti_info[RTAX_GATEWAY]))) {
ifafree(ifa);
rtfree(rt->rt_parent);
rtfree(rt->rt_gwroute);
- free(rt->rt_addr, M_RTABLE, 0);
free(rt->rt_gateway, M_RTABLE, 0);
free(ndst, M_RTABLE, dlen);
pool_put(&rtentry_pool, rt);
ifafree(ifa);
rtfree(rt->rt_parent);
rtfree(rt->rt_gwroute);
- free(rt->rt_addr, M_RTABLE, 0);
free(rt->rt_gateway, M_RTABLE, 0);
free(ndst, M_RTABLE, dlen);
pool_put(&rtentry_pool, rt);
return (0);
}
-int
-rt_setaddr(struct rtentry *rt, struct sockaddr *addr)
-{
- int alen = ROUNDUP(addr->sa_len);
- struct sockaddr *sa;
-
- KASSERT(rt->rt_addr == NULL);
-
- sa = malloc(alen, M_RTABLE, M_NOWAIT);
- if (sa == NULL)
- return (ENOBUFS);
-
- memmove(sa, addr, alen);
- rt->rt_addr = sa;
-
- return (0);
-}
-
int
rt_setgate(struct rtentry *rt, struct sockaddr *gate)
{
-/* $OpenBSD: rtsock.c,v 1.192 2016/06/14 09:48:52 mpi Exp $ */
+/* $OpenBSD: rtsock.c,v 1.193 2016/07/11 09:23:06 mpi Exp $ */
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
/*
ifp = if_get(rt->rt_ifidx);
if (ifp != NULL && rtm->rtm_addrs & (RTA_IFP|RTA_IFA)) {
info.rti_info[RTAX_IFP] = sdltosa(ifp->if_sadl);
- info.rti_info[RTAX_IFA] = rt->rt_addr;
+ info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
if (ifp->if_flags & IFF_POINTOPOINT)
info.rti_info[RTAX_BRD] =
rt->rt_ifa->ifa_dstaddr;
ifp = if_get(rt->rt_ifidx);
if (ifp != NULL) {
info.rti_info[RTAX_IFP] = sdltosa(ifp->if_sadl);
- info.rti_info[RTAX_IFA] = rt->rt_addr;
+ info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
if (ifp->if_flags & IFF_POINTOPOINT)
info.rti_info[RTAX_BRD] = rt->rt_ifa->ifa_dstaddr;
}