ifconfig triggers NPE in org.jnode.net.ipv4.config.impl.NetDeviceConfig

Project:JNode Core
Category:bug report

The first time I run ifconfig, the IP address assigned to an interface is reported as "set to null", but if I rerun ifconfig, the IP address shows as set. If I run a second ifconfig, then the IP is reported as well.

When I use the ifconfig command on the interface after setting it, I get null pointer error, which I suspect are coming from the netmask field.

The ifconfig command seems to take the netmask as a command line argument, but seems to ignore it.

The ifconfig command shows a netmask that appears to be calculated based on classed IP ranges ( for class A, etc).

Example session:
Jnode /> ifconfig eth-pci(0,20,0)
IP address for eth-pci(0,20,0) set to null

JNode /> ifconfig eth-pci(0,20,0)
IP address for eth-pci(0,20,0) set to

Exception in QueueProcessor: Net configuration processor
java.lang.NullPointerException: NPE at address 0BC6049B
at org.jnode.net.ipv4.config.impl.NetDeviceConfig$1.run(NetDeviceConfig.java:51)
at org.jnode.vm.VmAccessController.doPrivileged(VmAccessController.java:205)
at java.security.AccessController.doPrivileged(AccessController.java:141)
at org.jnode.net.ipv4.config.impl.NetDeviceConfig.apply(NetDeviceConfig.java:49)
at org.jnode.net.ipv4.config.impl.ConfigurationQueueEntry.apply(ConfigurationQueueEntry.java:47)
at org.jnode.net.ipv4.config.impl.ConfigurationProcessor.process(ConfigurationProcessor.java:72)
at org.jnode.net.ipv4.config.impl.ConfigurationProcessor.process(ConfigurationProcessor.java:33)
at org.jnode.util.QueueProcessorThread.run(QueueProcessorThread.java:106)
at org.jnode.vm.scheduler.VmThread.runThread(VmThread.java:678)

Jnode /> route - - null - UH - 0 - eth-pci(0,20,0)

Unfortunately for me, my local IP network is subnetted... (or IPnet netmask I may try to resurrect my classfull private network or something and try to take a look at org.jnode.net.ipv4.config.impl.NetDeviceConfig and see if something jumps out at me.

should that be fixed right now ?

I am not sure if we should fix that right now since all the network layers have been reworked in a branch : that's now in integration phase.

that said, I have no idea if the bug is in the modified/reworked parts or not.


my blog (in english and french)

Something to look out for ...

I built a debug version of the IfconfigCommand class to track down the NPE.

Timeline of events:
1. Jnode> ifconfig eth-pci(0,20,0)

2. IfconfigCommand.execute() in file
given string ifconfig eth-pci(0,20,0)
The command line size is 1 argument.

3. That string is passed to Help.Info.parse().
in shell/src/shell/org/jnode/shell/help/Help.java

4. Help.Info.parse() returns {<device>->null,<device>->["eth-pci(0,20,0)"]}
Is this a Hashmap entry being returned?
the command line size is now 2.

4. Because the cmdLine.size() returns 2, we skip if the first if (size ==0) {} block and go straight to the else. However, the first if {} contains the parts of ifconfig which print the MAC?

5. dev is setup with a whole array of strings that look like correct info for my card.

6. the second NetDevice api gets a valid instance of my card driver.

7. Because the cmdLine size is 2, we skill the if ( size == 1 ) and go straight to the inner else.

8. ip gets set to null.

9. mask get set to null.

10. cfg sets the IP and mask for dev to null, with no check for an existing one?

11. print out the new nulled IP address.

12. We're done.

This doesn't look correct to me at all.

I will work on it tonight and see if I can give everyone some concrete changes to evaluate.
Robert "Exile In Paradise" Murphey


We should continue to work on the networking layer in trunk while the new networking layer is still a work in progress.
So every bug found in trunk should be fixed in trunk. We will merge the two when the time is right.

sorry, please fix it !

I agree with levente : please fix it.

The fact is that the advancement of jnode (network stuff) in trunk must not be stopped by waiting for the new net layers since we don't know when they will be ready for integration on trunk.


my blog (in english and french)

now that problem solved

hi all,

actually in the config portion at the time of parameter passing the
value of the argumnt first not coming properly , but second time its ok...its now solved locally on my computer...........

but still there two more problems one I seen in jst few days before in
org.jnode.net.SocketBuffer there while appending two socketbuffers
with one (which previously intiallized) in consecutive statement......
are not taken properly the second one .........

and in IPv4Sender (org.jnode.net.ipv4.layer).sendPacket method there
at the time this statement api.transmit()....the socketbuffer passed
to the transmit method and there the protocolID set to the socketbuffer lost

thanks Exile for finding these ...and pls find more of them(bugs)
thanks all ........
best regards.........
boss jhonson..................

A partial explanation (?)

I was looking at this a couple of days ago for other reasons. The following message:

Jnode /> ifconfig eth-pci(0,20,0)
IP address for eth-pci(0,20,0) set to null

seems to be due to ConfigureServiceImpl.configureDeviceStatic not waiting for the QueueProcessor to do its stuff. Instead, it returns and ifconfig immediately queries the device to find the IP address ... which is still null of course. The code in configureDeviceStatic has a comment that implies that it doesn't wait because of a deadlock issue. Hmmmm....


boss, I hope this is what you want to see:

My Jnode PC initial runtime configuration:
1. Boot Jnode ( with all plugins and run garbage collector.

2. Configure the interface IP and netmask itself.
Jnode> ifconfig eth-pci(0,20,0)

3. Add a host route to the interface itself
Jnode> route add eth-pci(0,20,0)

4. Add a host route to the default gateway
Jnode> route add eth-pci(0,20,0)

5. Add a default route through the gateway
Jnode> route add default eth-pci(0,20,0)

6. Add a name server
Jnode> resolver add

7. Add a second name server
Jnode> resolver add

8. Turn on network debugging
Jnode> udpout

9. Run gc to cleanup.

10. Ping away.
Jnode> ping someIPsomewhere

Ping by IP address to any routeable IP works for me(tm).
Ping by name still throws exceptions.