aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/addr.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/core/addr.c')
-rw-r--r--drivers/infiniband/core/addr.c47
1 files changed, 40 insertions, 7 deletions
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index d98b05b28262..ce511d8748ce 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -128,6 +128,8 @@ int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr)
128 ret = rdma_copy_addr(dev_addr, dev, NULL); 128 ret = rdma_copy_addr(dev_addr, dev, NULL);
129 dev_put(dev); 129 dev_put(dev);
130 break; 130 break;
131
132#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
131 case AF_INET6: 133 case AF_INET6:
132 for_each_netdev(&init_net, dev) { 134 for_each_netdev(&init_net, dev) {
133 if (ipv6_chk_addr(&init_net, 135 if (ipv6_chk_addr(&init_net,
@@ -138,8 +140,7 @@ int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr)
138 } 140 }
139 } 141 }
140 break; 142 break;
141 default: 143#endif
142 break;
143 } 144 }
144 return ret; 145 return ret;
145} 146}
@@ -179,10 +180,11 @@ static void addr_send_arp(struct sockaddr *dst_in)
179{ 180{
180 struct rtable *rt; 181 struct rtable *rt;
181 struct flowi fl; 182 struct flowi fl;
182 struct dst_entry *dst;
183 183
184 memset(&fl, 0, sizeof fl); 184 memset(&fl, 0, sizeof fl);
185 if (dst_in->sa_family == AF_INET) { 185
186 switch (dst_in->sa_family) {
187 case AF_INET:
186 fl.nl_u.ip4_u.daddr = 188 fl.nl_u.ip4_u.daddr =
187 ((struct sockaddr_in *) dst_in)->sin_addr.s_addr; 189 ((struct sockaddr_in *) dst_in)->sin_addr.s_addr;
188 190
@@ -191,8 +193,13 @@ static void addr_send_arp(struct sockaddr *dst_in)
191 193
192 neigh_event_send(rt->u.dst.neighbour, NULL); 194 neigh_event_send(rt->u.dst.neighbour, NULL);
193 ip_rt_put(rt); 195 ip_rt_put(rt);
196 break;
197
198#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
199 case AF_INET6:
200 {
201 struct dst_entry *dst;
194 202
195 } else {
196 fl.nl_u.ip6_u.daddr = 203 fl.nl_u.ip6_u.daddr =
197 ((struct sockaddr_in6 *) dst_in)->sin6_addr; 204 ((struct sockaddr_in6 *) dst_in)->sin6_addr;
198 205
@@ -202,6 +209,9 @@ static void addr_send_arp(struct sockaddr *dst_in)
202 209
203 neigh_event_send(dst->neighbour, NULL); 210 neigh_event_send(dst->neighbour, NULL);
204 dst_release(dst); 211 dst_release(dst);
212 break;
213 }
214#endif
205 } 215 }
206} 216}
207 217
@@ -254,6 +264,7 @@ out:
254 return ret; 264 return ret;
255} 265}
256 266
267#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
257static int addr6_resolve_remote(struct sockaddr_in6 *src_in, 268static int addr6_resolve_remote(struct sockaddr_in6 *src_in,
258 struct sockaddr_in6 *dst_in, 269 struct sockaddr_in6 *dst_in,
259 struct rdma_dev_addr *addr) 270 struct rdma_dev_addr *addr)
@@ -282,6 +293,14 @@ static int addr6_resolve_remote(struct sockaddr_in6 *src_in,
282 dst_release(dst); 293 dst_release(dst);
283 return ret; 294 return ret;
284} 295}
296#else
297static int addr6_resolve_remote(struct sockaddr_in6 *src_in,
298 struct sockaddr_in6 *dst_in,
299 struct rdma_dev_addr *addr)
300{
301 return -EADDRNOTAVAIL;
302}
303#endif
285 304
286static int addr_resolve_remote(struct sockaddr *src_in, 305static int addr_resolve_remote(struct sockaddr *src_in,
287 struct sockaddr *dst_in, 306 struct sockaddr *dst_in,
@@ -340,7 +359,9 @@ static int addr_resolve_local(struct sockaddr *src_in,
340 struct net_device *dev; 359 struct net_device *dev;
341 int ret; 360 int ret;
342 361
343 if (dst_in->sa_family == AF_INET) { 362 switch (dst_in->sa_family) {
363 case AF_INET:
364 {
344 __be32 src_ip = ((struct sockaddr_in *) src_in)->sin_addr.s_addr; 365 __be32 src_ip = ((struct sockaddr_in *) src_in)->sin_addr.s_addr;
345 __be32 dst_ip = ((struct sockaddr_in *) dst_in)->sin_addr.s_addr; 366 __be32 dst_ip = ((struct sockaddr_in *) dst_in)->sin_addr.s_addr;
346 367
@@ -362,7 +383,12 @@ static int addr_resolve_local(struct sockaddr *src_in,
362 memcpy(addr->dst_dev_addr, dev->dev_addr, MAX_ADDR_LEN); 383 memcpy(addr->dst_dev_addr, dev->dev_addr, MAX_ADDR_LEN);
363 } 384 }
364 dev_put(dev); 385 dev_put(dev);
365 } else { 386 break;
387 }
388
389#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
390 case AF_INET6:
391 {
366 struct in6_addr *a; 392 struct in6_addr *a;
367 393
368 for_each_netdev(&init_net, dev) 394 for_each_netdev(&init_net, dev)
@@ -390,6 +416,13 @@ static int addr_resolve_local(struct sockaddr *src_in,
390 if (!ret) 416 if (!ret)
391 memcpy(addr->dst_dev_addr, dev->dev_addr, MAX_ADDR_LEN); 417 memcpy(addr->dst_dev_addr, dev->dev_addr, MAX_ADDR_LEN);
392 } 418 }
419 break;
420 }
421#endif
422
423 default:
424 ret = -EADDRNOTAVAIL;
425 break;
393 } 426 }
394 427
395 return ret; 428 return ret;