Ethernet interface aliases

63 views
Skip to first unread message

Vincent Prince

unread,
May 11, 2020, 6:56:02 AM5/11/20
to EIP Stack Group OpENer Developers
Hi all,

I'm new to OpENer and CIP/ethernetip technology,

I'm wondering if OpENer supports Linux ethernet interface aliases?

Target machine has a fallback ip on enp0s31f6 interface, which is not detected by OpENer.
I checked opener_user_conf.h file, especially OPENER_ETHLINK_INSTANCE_CNT and also POSIX/networkconfig.c GetIpAndNetmaskFromInterface function.
It seems it uses ioctl SIOCGIFADDR instead of getifaddrs, I'm not sure it can handle it?

Best regards,
Vincent

PS: Thanks for your bringing community an open-source CIP stack

Martin Melik-Merkumians

unread,
May 12, 2020, 6:13:23 AM5/12/20
to EIP Stack Group OpENer Developers
Hi Vincent,

first, thank you for your appreciation for the work done by all contributers to OpENer.

To be honest, I have no clue. Stefan wrote this code as an improvement to the original one provided by me, but I am not very deep into this topic.
If you have any further improvements here, I am open for discussion.

Best regards,
Martin

stm-at-esd

unread,
May 13, 2020, 6:40:10 AM5/13/20
to EIP Stack Group OpENer Developers


Am Montag, 11. Mai 2020 12:56:02 UTC+2 schrieb Vincent Prince:
Hi all,

I'm new to OpENer and CIP/ethernetip technology,

I'm wondering if OpENer supports Linux ethernet interface aliases?

Target machine has a fallback ip on enp0s31f6 interface, which is not detected by OpENer.
I checked opener_user_conf.h file, especially OPENER_ETHLINK_INSTANCE_CNT and also POSIX/networkconfig.c GetIpAndNetmaskFromInterface function.
It seems it uses ioctl SIOCGIFADDR instead of getifaddrs, I'm not sure it can handle it?

Hi Vincent,

sorry for being late with my response. Basically I'm confident that the ioctl(fd, SIOCGIFADDR, &ifr) will work on every interface the Linux kernel knows of. But not
all interfaces have an IPv4 address. Especially your wording about "a fallback ip on enp0s31f6" sounds to me that this interface is not a "normal" interface.

I would propose two things to get a clue what is going on:
a) Please add a printout of the errno value after the ioctl() call in the function GetIpAndNetmaskFromInterface(). A perror() call before the close() call of line 77
  should suffice.
b) To show us how your system is really configured you may use the example code for getifaddrs() that is included in the man page of getifaddrs(). Put it into
  a source file, compile it and then run it in parallel to OpENer on the machine where the OpENer runs. That will show us what you would see with getifaddrs(). 
  I guess that the interface enp0s31f6 has no IPv4 address at that moment when OpENer runs.

Best regards,
    Stefan

Reply all
Reply to author
Forward
0 new messages