From: David van Moolenbroek Date: Sun, 18 Aug 2013 10:04:25 +0000 (+0200) Subject: libnetdriver: only block datalink messages X-Git-Tag: v3.3.0~839 X-Git-Url: http://zhaoyanbai.com/repos/?a=commitdiff_plain;h=4cd78c64a4f3e9ec147cae90c3d00f15d5ba3c14;p=minix.git libnetdriver: only block datalink messages Previously, all incoming messages would be blocked before a DL_CONF message arrives from the TCP/IP stack. This however makes it impossible for a driver to process interrupts before the DL_CONF initialization. This patch blocks only datalink messages before the initial DL_CONF, and lets through all other messages to the driver. Change-Id: I89988958c0bff9bb38e0379b66f6142491a67b61 --- diff --git a/include/minix/com.h b/include/minix/com.h index f35d0e108..293a1a333 100644 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -255,6 +255,9 @@ #define DL_RQ_BASE 0x200 #define DL_RS_BASE 0x280 +#define IS_DL_RQ(type) (((type) & ~0x7f) == DL_RQ_BASE) +#define IS_DL_RS(type) (((type) & ~0x7f) == DL_RS_BASE) + /* Message types for data link layer requests. */ #define DL_CONF (DL_RQ_BASE + 0) #define DL_GETSTAT_S (DL_RQ_BASE + 1) diff --git a/lib/libnetdriver/netdriver.c b/lib/libnetdriver/netdriver.c index 8b49017d4..a2176e451 100644 --- a/lib/libnetdriver/netdriver.c +++ b/lib/libnetdriver/netdriver.c @@ -59,6 +59,11 @@ int *status_ptr; return r; } + /* Let non-datalink requests through regardless. */ + if (!IS_DL_RQ(m_ptr->m_type)) { + return r; + } + /* See if only DL_CONF is to be expected. */ if(conf_expected) { if(m_ptr->m_type == DL_CONF) {