Bug 1215621

Summary: YaST2 iscsi-client: iscsi initiator uses deprecated ifconfig
Product: [openSUSE] openSUSE Distribution Reporter: Per Jessen <per>
Component: YaST2Assignee: YaST Team <yast-internal>
Status: CONFIRMED --- QA Contact: Jiri Srain <jsrain>
Severity: Normal    
Priority: P5 - None CC: lduncan
Version: Leap 15.5   
Target Milestone: ---   
Hardware: Other   
OS: Other   
URL: https://trello.com/c/gdwdXHCg
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Per Jessen 2023-09-22 15:03:01 UTC
I am trying to set up an iscsi initiator using a bnx2 offload device.  I am seeing a couple of issues. 

a) IscsiClientLib.rb - uses ifconfig, which is deprecated.  Line 1786. 

Can be worked around by installing "net-tools-deprecated".  See also bug#1215537

b) when trying to connect to a target, I get this error:
Connection to discovery portal 10.42.8.10 failed: internal error
Error output: iscsiadm: Please set the iface.ipaddress for iface eth4-bnx2i, then retry the login command.

c) after having set "iface.ipaddress" manually and retrying the connection:

iscsiadm: Could not set host net params (err 29)

I believe the above is due to an issue in iscsiuio, I'll open a separate ticket on that.
Comment 1 Stefan Hundhammer 2023-09-25 15:16:03 UTC
AFAIK it doesn't do much with the 'ifconfig' command, it just uses it to figure out the interface device name and maybe the current IP address. It should be fairly easy to migrate that to the 'ip' command.
Comment 2 Stefan Hundhammer 2023-09-26 08:34:56 UTC
Moving to our Trello task queue.
Comment 3 Stefan Hundhammer 2023-09-26 12:41:02 UTC
Relevant code:

https://github.com/yast/yast-iscsi-client/blob/SLE-15-SP6/src/modules/IscsiClientLib.rb#L1784-L1807

This comes down to calling 'ifconfig <interface-name>' and then filtering out a line with 'inet addr:', i.e. the equivalent of

  ifconfig eth0 | grep 'inet addr:'

which on every not-too-ancient SUSE Linux always returns nothing because the output format changed long ago:

> %ifconfig br0
> br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
>         inet 192.168.178.2  netmask 255.255.255.0  broadcast 192.168.178.255
>         inet6 fe80::1e6f:65ff:fe2c:92f7  prefixlen 64  scopeid 0x20<link>
>         inet6 2003:eb:af1d:f00:1e6f:65ff:fe2c:92f7  prefixlen 64  scopeid 0x0<global>
>         inet6 2003:eb:af1d:f00:366c:e49d:8ed5:af6e  prefixlen 64  scopeid 0x0<global>
>         ether 1c:6f:65:2c:92:f7  txqueuelen 1000  (Ethernet)
>         RX packets 1165279  bytes 1484299539 (1.3 GiB)
>         RX errors 0  dropped 0  overruns 0  frame 0
>         TX packets 560775  bytes 77258742 (73.6 MiB)
>         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

(On my Leap 15.5 where that interface is /dev/br0)

It works on SLE-12 SP5, though:

> eth0      Link encap:Ethernet  HWaddr 00:16:3E:48:17:FF  
>           inet addr:10.160.0.1  Bcast:10.160.255.255  Mask:255.255.0.0
>           inet6 addr: fe80::216:3eff:fe48:17ff/64 Scope:Link
>           inet6 addr: fec0:0:0:ffff::2/64 Scope:Site
>           inet6 addr: 2620:113:80c0:8080:10:160:0:1/64 Scope:Global
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           RX packets:1032577881 errors:0 dropped:54 overruns:0 frame:0
>           TX packets:980188178 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:1000 
>           RX bytes:2198620121319 (2096767.5 Mb)  TX bytes:370757248357 (353581.6 Mb)

> % ifconfig eth0 | grep 'inet addr' 
>          inet addr:10.160.0.1  Bcast:10.160.255.255  Mask:255.255.0.0

So either that information is not really needed (which I believe), or it never worked with any recent SLE-15 SPx / Leap 15.x (unlikely).
Comment 4 Lukas Ocilka 2023-09-26 13:59:48 UTC
And I guess there is no test-case or description in the code :)
Cool
Comment 5 Per Jessen 2023-09-26 19:29:49 UTC
(In reply to Stefan Hundhammer from comment #3)
> So either that information is not really needed (which I believe), or it
> never worked with any recent SLE-15 SPx / Leap 15.x (unlikely).

I have not yet had any luck getting my offload interfaces to work - I keep getting told "Please set the iface.ipaddress for iface eth4-bnx2i, then retry the login command.".  I have so far just edited /etc/iscsi/iface/eth4-bnx2i to set that address, but then I get stuck again. 

The issue with iscsiuio in bug#1215622 is the same in Leap 15.0, so I don't think this has worked since 15.0 at least.
Comment 6 Per Jessen 2023-09-29 16:35:53 UTC
(In reply to Per Jessen from comment #5)
> (In reply to Stefan Hundhammer from comment #3)
> > So either that information is not really needed (which I believe), or it
> > never worked with any recent SLE-15 SPx / Leap 15.x (unlikely).
> 
> I have not yet had any luck getting my offload interfaces to work - I keep
> getting told "Please set the iface.ipaddress for iface eth4-bnx2i, then
> retry the login command.". 

Just a quick update - after having installed net-tools-deprecated and fixed the yast code, then cleared out my config and started over - now it works fine.
Comment 7 Lee Duncan 2024-05-16 16:37:35 UTC
I would suggest changing the code to use ip instead of ifconfig. Installing deprecated tools sounds like a good work around but not a solution.

It could simply run:

> ip addr show dev <NICNAME> | grep 'inet '

And remove the "/24" (width) from the IP address.

Normal output looks like:

> # ip addr show dev eth0
> 5: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP > group default qlen 1000
>     link/ether 10:65:30:bf:77:7d brd ff:ff:ff:ff:ff:ff
>     altname enp14s0u1u2
>     inet 192.168.20.3/24 brd 192.168.20.255 scope global eth0
>        valid_lft forever preferred_lft forever
>     inet6 fe80::1265:30ff:febf:777d/64 scope link 
>        valid_lft forever preferred_lft forever

And let's hope NICs continue to have an IPv4 address. :)