This now explicitly enforces the logic already hinted at, which should prefer
hardware address over net_ifacename in all circumstances. Previously the 'else
if' was always being executed.

Signed-off-by: Jim Ramsay <[email protected]>
---
 usr/io.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/usr/io.c b/usr/io.c
index fef6785..8d37d43 100644
--- a/usr/io.c
+++ b/usr/io.c
@@ -303,14 +303,16 @@ static int bind_conn_to_iface(iscsi_conn_t *conn, struct 
iface_rec *iface)
                return 0;
 
        memset(session->netdev, 0, IFNAMSIZ);
-       if (iface_is_bound_by_hwaddr(iface) &&
-           net_get_netdev_from_hwaddress(iface->hwaddress, session->netdev)) {
-               log_error("Cannot match %s to net/scsi interface.",
-                         iface->hwaddress);
-                return -1;
-       } else if (iface_is_bound_by_netdev(iface))
+       if (iface_is_bound_by_hwaddr(iface)) {
+               if (net_get_netdev_from_hwaddress(iface->hwaddress,
+                                                 session->netdev)) {
+                       log_error("Cannot match %s to net/scsi interface.",
+                                 iface->hwaddress);
+                       return -1;
+               }
+       } else if (iface_is_bound_by_netdev(iface)) {
                strcpy(session->netdev, iface->netdev);
-       else if (iface_is_bound_by_ipaddr(iface)) {
+       } else if (iface_is_bound_by_ipaddr(iface)) {
                /*
                 * we never supported this but now with offload having to
                 * set the ip address in the iface, useris may forget to
-- 
1.7.6

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.

Reply via email to