aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2008-12-30 02:37:14 -0500
committerRoland Dreier <rolandd@cisco.com>2008-12-30 02:37:14 -0500
commit2c4ab6243f91cda62f22af2eb8a6c07590de37b1 (patch)
treebb548c0e8fd5ecaad58a037843a4c81c4e587d01 /drivers/infiniband
parent541ef5cbb8e68189d47272cea52a69abc30259bc (diff)
RDMA/addr: Fix build breakage when IPv6 is disabled
Commit 38617c64 ("RDMA/addr: Add support for translating IPv6 addresses") broke the build when CONFIG_IPV6=n, because the ib_addr module unconditionally attempted to call ipv6_chk_addr() and other IPv6 functions that are not defined when IPv6 is disabled. Fix this by only building IPv6 support if CONFIG_IPV6 is turned on, and add a Kconfig dependency to prevent the ib_addr code from being built in when IPv6 is built modular. Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/Kconfig1
-rw-r--r--drivers/infiniband/core/addr.c47
2 files changed, 41 insertions, 7 deletions
diff --git a/drivers/infiniband/Kconfig b/drivers/infiniband/Kconfig
index a5dc78ae62d4..dd0db67bf8d7 100644
--- a/drivers/infiniband/Kconfig
+++ b/drivers/infiniband/Kconfig
@@ -37,6 +37,7 @@ config INFINIBAND_USER_MEM
37config INFINIBAND_ADDR_TRANS 37config INFINIBAND_ADDR_TRANS
38 bool 38 bool
39 depends on INET 39 depends on INET
40 depends on !(INFINIBAND = y && IPV6 = m)
40 default y 41 default y
41 42
42source "drivers/infiniband/hw/mthca/Kconfig" 43source "drivers/infiniband/hw/mthca/Kconfig"
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;