[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>
This commit is contained in:
Mitchell Blank Jr 2005-11-29 16:13:32 -08:00 committed by David S. Miller
parent 18955cfcb2
commit c9933d0856

View File

@ -423,8 +423,17 @@ int vcc_connect(struct socket *sock, int itf, short vpi, int vci)
if (vcc->qos.txtp.traffic_class == ATM_ANYCLASS ||
vcc->qos.rxtp.traffic_class == ATM_ANYCLASS)
return -EINVAL;
if (itf != ATM_ITF_ANY) {
if (likely(itf != ATM_ITF_ANY)) {
dev = atm_dev_lookup(itf);
} else {
dev = NULL;
spin_lock(&atm_dev_lock);
if (!list_empty(&atm_devs)) {
dev = list_entry(atm_devs.next, struct atm_dev, dev_list);
atm_dev_hold(dev);
}
spin_unlock(&atm_dev_lock);
}
if (!dev)
return -ENODEV;
error = __vcc_connect(vcc, dev, vpi, vci);
@ -432,25 +441,6 @@ int vcc_connect(struct socket *sock, int itf, short vpi, int vci)
atm_dev_put(dev);
return error;
}
} else {
struct list_head *p, *next;
dev = NULL;
spin_lock(&atm_dev_lock);
list_for_each_safe(p, next, &atm_devs) {
dev = list_entry(p, struct atm_dev, dev_list);
atm_dev_hold(dev);
spin_unlock(&atm_dev_lock);
if (!__vcc_connect(vcc, dev, vpi, vci))
break;
atm_dev_put(dev);
dev = NULL;
spin_lock(&atm_dev_lock);
}
spin_unlock(&atm_dev_lock);
if (!dev)
return -ENODEV;
}
if (vpi == ATM_VPI_UNSPEC || vci == ATM_VCI_UNSPEC)
set_bit(ATM_VF_PARTIAL,&vcc->flags);
if (test_bit(ATM_VF_READY,&ATM_SD(sock)->flags))