-/* $OpenBSD: route.c,v 1.211 2015/05/26 12:02:11 mpi Exp $ */
+/* $OpenBSD: route.c,v 1.212 2015/05/26 12:19:51 mpi Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
struct ifaddr *ifa;
struct sockaddr *ndst;
struct sockaddr_rtlabel *sa_rl, sa_rl2;
+ struct sockaddr_dl sa_dl = { sizeof(sa_dl), AF_LINK };
int dlen, error;
#ifdef MPLS
struct sockaddr_mpls *sa_mpls;
info->rti_ifa = NULL;
info->rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
}
+
info->rti_flags = rt->rt_flags & ~(RTF_CLONING | RTF_STATIC);
info->rti_flags |= RTF_CLONED;
- info->rti_info[RTAX_GATEWAY] = rt->rt_gateway;
+ info->rti_info[RTAX_GATEWAY] = (struct sockaddr *)&sa_dl;
info->rti_flags |= RTF_HOST;
info->rti_info[RTAX_LABEL] =
rtlabel_id2sa(rt->rt_labelid, &sa_rl2);
info.rti_ifa = ifa;
info.rti_flags = flags | RTF_MPATH;
info.rti_info[RTAX_DST] = dst;
- info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&sa_dl;
+ if (flags & RTF_LLINFO)
+ info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&sa_dl;
+ else
+ info.rti_info[RTAX_GATEWAY] = ifa->ifa_addr;
info.rti_info[RTAX_LABEL] =
rtlabel_id2sa(ifa->ifa_ifp->if_rtlabelid, &sa_rl);
info.rti_ifa = ifa;
info.rti_flags = flags;
info.rti_info[RTAX_DST] = dst;
- info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&sa_dl;
+ if (flags & RTF_LLINFO)
+ info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&sa_dl;
+ else
+ info.rti_info[RTAX_GATEWAY] = ifa->ifa_addr;
info.rti_info[RTAX_LABEL] =
rtlabel_id2sa(ifa->ifa_ifp->if_rtlabelid, &sa_rl);
-/* $OpenBSD: in.c,v 1.116 2015/05/15 12:00:57 claudio Exp $ */
+/* $OpenBSD: in.c,v 1.117 2015/05/26 12:19:51 mpi Exp $ */
/* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */
/*
return (error);
if (ia->ia_broadaddr.sin_addr.s_addr != 0)
- error = rt_ifa_add(ifa, RTF_UP | RTF_HOST |
- RTF_LLINFO | RTF_BROADCAST, ifa->ifa_broadaddr);
+ error = rt_ifa_add(ifa, RTF_UP | RTF_HOST | RTF_BROADCAST,
+ ifa->ifa_broadaddr);
if (!error)
ia->ia_flags |= IFA_ROUTE;
rt_ifa_del(ifa, 0, ifa->ifa_addr);
if (ia->ia_broadaddr.sin_addr.s_addr != 0)
- rt_ifa_del(ifa, RTF_HOST | RTF_LLINFO | RTF_BROADCAST,
- ifa->ifa_broadaddr);
+ rt_ifa_del(ifa, RTF_HOST | RTF_BROADCAST, ifa->ifa_broadaddr);
ia->ia_flags &= ~IFA_ROUTE;
}
-/* $OpenBSD: in6.c,v 1.157 2015/05/15 12:00:57 claudio Exp $ */
+/* $OpenBSD: in6.c,v 1.158 2015/05/26 12:19:52 mpi Exp $ */
/* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */
/*
/* join solicited multicast addr for new host id */
struct sockaddr_in6 llsol;
- struct sockaddr_dl sa_dl = { sizeof(sa_dl), AF_LINK };
-
- sa_dl.sdl_type = ifp->if_type;
- sa_dl.sdl_index = ifp->if_index;
bzero(&llsol, sizeof(llsol));
llsol.sin6_family = AF_INET6;
bzero(&info, sizeof(info));
info.rti_info[RTAX_DST] = sin6tosa(&mltaddr);
- info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&sa_dl;
+ info.rti_info[RTAX_GATEWAY] = sin6tosa(&ia6->ia_addr);
info.rti_info[RTAX_NETMASK] = sin6tosa(&mltmask);
info.rti_info[RTAX_IFA] = sin6tosa(&ia6->ia_addr);
/* XXX: we need RTF_CLONING to fake nd6_rtrequest */
bzero(&info, sizeof(info));
info.rti_info[RTAX_DST] = sin6tosa(&mltaddr);
- info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&sa_dl;
+ info.rti_info[RTAX_GATEWAY] = sin6tosa(&ia6->ia_addr);
info.rti_info[RTAX_NETMASK] = sin6tosa(&mltmask);
info.rti_info[RTAX_IFA] = sin6tosa(&ia6->ia_addr);
info.rti_flags = RTF_UP | RTF_CLONING;
-/* $OpenBSD: nd6_rtr.c,v 1.103 2015/05/15 12:00:57 claudio Exp $ */
+/* $OpenBSD: nd6_rtr.c,v 1.104 2015/05/26 12:19:52 mpi Exp $ */
/* $KAME: nd6_rtr.c,v 1.97 2001/02/07 11:09:13 itojun Exp $ */
/*
bzero(&info, sizeof(info));
info.rti_flags = rtflags;
info.rti_info[RTAX_DST] = sin6tosa(&pr->ndpr_prefix);
- info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&sa_dl;
+ info.rti_info[RTAX_GATEWAY] = ifa->ifa_addr;
info.rti_info[RTAX_NETMASK] = sin6tosa(&mask6);
error = rtrequest1(RTM_ADD, &info, RTP_CONNECTED, &rt, ifp->if_rdomain);