Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#9446 closed bug (fixed)

[net_server] doesn't bring up newly plugged interfaces

Reported by: diver Owned by: phoudoin
Priority: normal Milestone: R1
Component: Servers/net_server Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

This is hrev45257.

I have an usb ethernet adapter which uses usb_davicom driver.

If I plug it in I have to manually issue ifconfig /dev/net/usb_davicom/0 up to bring it up, otherwise it's not listed in ifconfig output.

Change History (9)

comment:1 by phoudoin, 12 years ago

Could you try again, but this time while running net_server from a Terminal window:

  • stop net_server via Deskbar
  • open a Terminal
  • type: net_server
  • plug your usb ethernet adapter
  • post here the messages printed by net_server.

comment:2 by diver, 12 years ago

net_server: Setting flags failed: Invalid Argument
service ssh has no address specified
BMessage('_PMN') {
        opcode = int32(0x1 or 1)
        device = int32(0x2 or 2)
        directory = int64(0xcd or 205)
        name = string("0", 2 bytes)
        added = bool(true)
        path = string("/dev/net/usb_davicom/0", 23 bytes)
        watched_path = string("/dev/net", 9 bytes)
}
BMessage('_PMN') {
        opcode = int32(0x1 or 1)
        device = int32(0x2 or 2)
        directory = int64(0x15 or 21)
        node = int64(0xcd or 205)
        name = string("usb_davicom", 12 bytes)
        added = bool(true)
        path = string("/dev/net/usb_davicom/0", 23 bytes)
        watched_path = string("/dev/net", 9 bytes)
}

comment:3 by diver, 12 years ago

Actually the above was printed with local modification:

diff --git a/src/servers/net/NetServer.cpp b/src/servers/net/NetServer.cpp
index 2e9c045..26ec2c1 100644
--- a/src/servers/net/NetServer.cpp
+++ b/src/servers/net/NetServer.cpp
@@ -964,6 +964,7 @@ NetServer::_StartServices()
 status_t
 NetServer::_HandleDeviceMonitor(BMessage* message)
 {
+       message->PrintToStream();
        int32 opcode;

Without it net_server doesn't output anything when I plug my usb ethernet adapter. Any ideas?

comment:4 by diver, 12 years ago

phoudoin, anything else I could try?

comment:5 by phoudoin, 12 years ago

Sorry, I still don't have a working Haiku system setup to dive myself here. Meanwhile:

  • the first message is correct, and should call _ConfigureDevice(), which in turn calls _ConfigureInterface() and launch an AutoConfigLooper on it (DHCP)
  • the second message is not a leaf path but a directory. Which is nowhere checked so it does too, right after (and *before* the AutoConfigLooper have finish), call _ConfigureDevice() -> _ConfigureInterface() where it must dies somewhere, possibly breaking the /dev/net/usb_davicom/0 device configuration.

What you could try, beside adding some printf() here and there in _ConfigureInterface(), is to add a check in _HandleDeviceMonitor():

-	if (strncmp(path, "/dev/net", 9)) {
+	BEntry entry(path);
+	if (entry.IsDirectory() || strncmp(path, "/dev/net", 9)) {
+		// not a valid device entry, ignore
		return B_NAME_NOT_FOUND;
	}

You may need to add #include <Entry.h> header, too.

comment:6 by phoudoin, 12 years ago

In anycase, BPathMonitor with B_WATCH_FILES_ONLY should not notify about folder entries. Something is clearly broken here.

comment:7 by phoudoin, 12 years ago

Owner: changed from axeld to phoudoin
Status: newassigned

comment:8 by phoudoin, 12 years ago

Status: assignedin-progress

comment:9 by phoudoin, 12 years ago

Resolution: fixed
Status: in-progressclosed

Fixed in hrev45525. Blame me for this bug I'm so sorry I've introduced two years ago in hrev41274.

Last edited 12 years ago by phoudoin (previous) (diff)
Note: See TracTickets for help on using tickets.