summaryrefslogtreecommitdiffstats
path: root/sys/ofed/drivers
diff options
context:
space:
mode:
authormelifaro <melifaro@FreeBSD.org>2014-11-27 23:06:25 +0000
committermelifaro <melifaro@FreeBSD.org>2014-11-27 23:06:25 +0000
commit95c680b9a37dc9e1e605f6d9ce346203c0d1aac4 (patch)
treeb985650fb7687bf95b809dfda2d768fed6e073d2 /sys/ofed/drivers
parent09e88907610d93e098d017e8e705eed832e10d21 (diff)
downloadFreeBSD-src-95c680b9a37dc9e1e605f6d9ce346203c0d1aac4.zip
FreeBSD-src-95c680b9a37dc9e1e605f6d9ce346203c0d1aac4.tar.gz
Do not return unlocked/unreferenced lle in arpresolve/nd6_storelladdr -
return lle flags IFF needed. Do not pass rte to arpresolve - pass is_gateway flag instead.
Diffstat (limited to 'sys/ofed/drivers')
-rw-r--r--sys/ofed/drivers/infiniband/core/addr.c10
-rw-r--r--sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c8
2 files changed, 10 insertions, 8 deletions
diff --git a/sys/ofed/drivers/infiniband/core/addr.c b/sys/ofed/drivers/infiniband/core/addr.c
index f608244..c3d5b4f 100644
--- a/sys/ofed/drivers/infiniband/core/addr.c
+++ b/sys/ofed/drivers/infiniband/core/addr.c
@@ -347,14 +347,12 @@ static int addr_resolve(struct sockaddr *src_in,
struct sockaddr_in6 *sin6;
struct ifaddr *ifa;
struct ifnet *ifp;
-#if defined(INET) || defined(INET6)
- struct llentry *lle;
-#endif
struct rtentry *rte;
in_port_t port;
u_char edst[MAX_ADDR_LEN];
int multi;
int bcast;
+ int is_gw = 0;
int error = 0;
/*
@@ -430,6 +428,8 @@ static int addr_resolve(struct sockaddr *src_in,
RTFREE_LOCKED(rte);
return -EHOSTUNREACH;
}
+ if (rte->rt_flags & RTF_GATEWAY)
+ is_gw = 1;
/*
* If it's not multicast or broadcast and the route doesn't match the
* requested interface return unreachable. Otherwise fetch the
@@ -467,12 +467,12 @@ mcast:
switch (dst_in->sa_family) {
#ifdef INET
case AF_INET:
- error = arpresolve(ifp, rte, NULL, dst_in, edst, &lle);
+ error = arpresolve(ifp, is_gw, NULL, dst_in, edst, NULL);
break;
#endif
#ifdef INET6
case AF_INET6:
- error = nd6_storelladdr(ifp, NULL, dst_in, (u_char *)edst, &lle);
+ error = nd6_storelladdr(ifp, NULL, dst_in, (u_char *)edst,NULL);
break;
#endif
default:
diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 5cd3441..b3afc210 100644
--- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -1259,13 +1259,15 @@ ipoib_output(struct ifnet *ifp, struct mbuf *m,
struct llentry *lle = NULL;
struct rtentry *rt0 = NULL;
struct ipoib_header *eh;
- int error = 0;
+ int error = 0, is_gw = 0;
short type;
if (ro != NULL) {
if (!(m->m_flags & (M_BCAST | M_MCAST)))
lle = ro->ro_lle;
rt0 = ro->ro_rt;
+ if (rt0 != NULL && (rt0->rt_flags & RTF_GATEWAY) != 0)
+ is_gw = 1;
}
#ifdef MAC
error = mac_ifnet_check_transmit(ifp, m);
@@ -1292,7 +1294,7 @@ ipoib_output(struct ifnet *ifp, struct mbuf *m,
else if (m->m_flags & M_MCAST)
ip_ib_mc_map(((struct sockaddr_in *)dst)->sin_addr.s_addr, ifp->if_broadcastaddr, edst);
else
- error = arpresolve(ifp, rt0, m, dst, edst, &lle);
+ error = arpresolve(ifp, is_gw, m, dst, edst, NULL);
if (error)
return (error == EWOULDBLOCK ? 0 : error);
type = htons(ETHERTYPE_IP);
@@ -1330,7 +1332,7 @@ ipoib_output(struct ifnet *ifp, struct mbuf *m,
else if (m->m_flags & M_MCAST)
ipv6_ib_mc_map(&((struct sockaddr_in6 *)dst)->sin6_addr, ifp->if_broadcastaddr, edst);
else
- error = nd6_storelladdr(ifp, m, dst, (u_char *)edst, &lle);
+ error = nd6_storelladdr(ifp, m, dst, (u_char *)edst, NULL);
if (error)
return error;
type = htons(ETHERTYPE_IPV6);
OpenPOWER on IntegriCloud