aboutsummaryrefslogtreecommitdiffstats
path: root/net/atm
diff options
context:
space:
mode:
authorMitchell Blank Jr <mitch@sfgoth.com>2005-11-29 19:13:32 -0500
committerDavid S. Miller <davem@davemloft.net>2005-11-29 19:13:32 -0500
commitc9933d0856d6d0ede6b4b30e5e7330614f5203af (patch)
tree5f31d09df861fd83fc327a7eb5b5ac12bfc4188e /net/atm
parent18955cfcb2a5d75a08e0cb297f13ccfb6904de48 (diff)
[ATM]: always return the first interface for ATM_ITF_ANY
From: Mitchell Blank Jr <mitch@sfgoth.com> Signed-off-by: Chas Williams <chas@cmf.nrl.navy.mil> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/atm')
-rw-r--r--net/atm/common.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/net/atm/common.c b/net/atm/common.c
index 63feea49fb13..83454e12317d 100644
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -423,33 +423,23 @@ int vcc_connect(struct socket *sock, int itf, short vpi, int vci)
423 if (vcc->qos.txtp.traffic_class == ATM_ANYCLASS || 423 if (vcc->qos.txtp.traffic_class == ATM_ANYCLASS ||
424 vcc->qos.rxtp.traffic_class == ATM_ANYCLASS) 424 vcc->qos.rxtp.traffic_class == ATM_ANYCLASS)
425 return -EINVAL; 425 return -EINVAL;
426 if (itf != ATM_ITF_ANY) { 426 if (likely(itf != ATM_ITF_ANY)) {
427 dev = atm_dev_lookup(itf); 427 dev = atm_dev_lookup(itf);
428 if (!dev)
429 return -ENODEV;
430 error = __vcc_connect(vcc, dev, vpi, vci);
431 if (error) {
432 atm_dev_put(dev);
433 return error;
434 }
435 } else { 428 } else {
436 struct list_head *p, *next;
437
438 dev = NULL; 429 dev = NULL;
439 spin_lock(&atm_dev_lock); 430 spin_lock(&atm_dev_lock);
440 list_for_each_safe(p, next, &atm_devs) { 431 if (!list_empty(&atm_devs)) {
441 dev = list_entry(p, struct atm_dev, dev_list); 432 dev = list_entry(atm_devs.next, struct atm_dev, dev_list);
442 atm_dev_hold(dev); 433 atm_dev_hold(dev);
443 spin_unlock(&atm_dev_lock);
444 if (!__vcc_connect(vcc, dev, vpi, vci))
445 break;
446 atm_dev_put(dev);
447 dev = NULL;
448 spin_lock(&atm_dev_lock);
449 } 434 }
450 spin_unlock(&atm_dev_lock); 435 spin_unlock(&atm_dev_lock);
451 if (!dev) 436 }
452 return -ENODEV; 437 if (!dev)
438 return -ENODEV;
439 error = __vcc_connect(vcc, dev, vpi, vci);
440 if (error) {
441 atm_dev_put(dev);
442 return error;
453 } 443 }
454 if (vpi == ATM_VPI_UNSPEC || vci == ATM_VCI_UNSPEC) 444 if (vpi == ATM_VPI_UNSPEC || vci == ATM_VCI_UNSPEC)
455 set_bit(ATM_VF_PARTIAL,&vcc->flags); 445 set_bit(ATM_VF_PARTIAL,&vcc->flags);