#!/bin/bash

for dir in /sys/firmware/ibft/ethernet{0,1} ; do
        [ ! -e $dir/mac ] && continue || \
            ibft_mac=$(cat $dir/mac)
        ibft_eth=$(ls $dir/device/net)
        if [ $? -ne 0 ]; then
            >&2 echo "Unable to find network interface for iSCSI iBFT mac $ibft_mac"
            continue
        fi
        echo ${ibft_eth}
    done
