Subnet not being taken during manual configuration of IP address on iMX6

Hello.

There seems to be something wrong with the manual configuration of IP address on iMX6. In our software, to manually set the IP address, we first write the parameters to the relevant registry-keys:

HKEY_LOCAL_MACHINE\Comm\NETRTWLANU1\Parms\TcpIp\EnableDHCP
HKEY_LOCAL_MACHINE\Comm\NETRTWLANU1\Parms\TcpIp\IPAddress
HKEY_LOCAL_MACHINE\Comm\NETRTWLANU1\Parms\TcpIp\SubnetMask

Then we RegFlush() to save the registry. And finally we rebind the adapter using the function DeviceIoControl() with IOCTL_NDIS_REBIND_ADAPTER.

In general this works, but the issue we found is that the Subnet mask seems to be ignored. This is obvious when we set the Subnet mask to an invalid value (e.g. 200.0.0.0) and we find that we can still communicate with the device. I have also confirmed it using the Network - Control Panel applet and with that the behavior is the same.

With the old platform we were using (Colibri PXA with WinCE 6.0), this was not happening. On that board, when we set the Subnet mask to 200.0.0.0 the communication gets lost.

Dear @dennisL

I see a different behavior on my iMX6 (WEC7 BSP 1.5), wired ethernet controller:

Test

I entered the IP configuration including the invalid subnet mask 200.0.0.0 using the registry editor, saved the registry and rebooted. I verified the configuration in the control panel applet as well as on the command line using ipconfig. Both verification showed that the subnet mask was converted to the valid value 192.0.0.0, while the registry still contained 200.0.0.0.

Remark: to rebind the network card, you can also use the built-in command

  ndisconfig adapter rebind NETRTWLANU1

Result

I was able to communicate to all internal devices - which is expected, as according to the subnet mask, almost all devices are treated as being in the local subnet.
And I failed to ping google (216.58.215.227) with an error code 11003 (misconfigured system files)

Conclusion

So this is all working as expected. The only somehow unpredictable behavior is, that the invalid subnet mask gets converted to a valid one automatically. This might have been different between CE6 and WEC7.

Can you give us some usecase why this actually matters to you?

Regards, Andy

Hello, @andy.tx.

Thank you for the clarification. Actually, the issue is not so critical. However, it is disturbing our System Test and causing this particular test case to fail.

Our software has limited network functionality. The network is used mainly to communicate with a ftp server or to print out to a network-connected printer provided these are in the local intranet. Since we have disabled the OS shell, basically the only thing that the user would see on the device is our software. There is no way for the casual user to determine the device’s actual TCP/IP parameters other than what we display in our system menu.

In our system-test, the negative case is covered by putting in an invalid Subnet mask then we try to ping the device from a PC that is also connected to our network.

This used to work (the device cannot be pinged) when our software was running on the Colibri PXA with WinCE 6.0. But now we are porting our software to the iMX6 board and our system test is failing this particular test case.

Dear @dennisL

Maybe you can simply modify your test slightly:
Just unload the network adapter to make it invisible:

ndisconfig adapter del NETRTWLANU1

and reload it to activate it again

ndisconfig adapter add NETRTWLANU NETRTWLANU1

If you don’t want to call command line functions, there are also regular APIs to achieve the same functionality.

Regards, Andy