diff -Naurb --exclude=CVS --exclude=*.am --exclude=configure --exclude=*.in --exclude=*~ rtems-ss-20010424/c/src/libnetworking/kern/uipc_socket.c rtems/c/src/libnetworking/kern/uipc_socket.c
--- rtems-ss-20010424/c/src/libnetworking/kern/uipc_socket.c	Fri Jun 11 18:11:41 1999
+++ rtems/c/src/libnetworking/kern/uipc_socket.c	Fri Sep 20 15:29:21 2002
@@ -194,7 +194,8 @@
 		}
 		if (so->so_options & SO_LINGER) {
 			if ((so->so_state & SS_ISDISCONNECTING) &&
-			    (so->so_state & SS_NBIO))
+			    ((so->so_state & SS_NBIO) ||
+			     (so->so_rcv.sb_timeo == (u_long)(-1))))
 				goto drop;
 			while (so->so_state & SS_ISCONNECTED) {
 				soconnsleep (so);
@@ -401,7 +402,8 @@
 			snderr(EMSGSIZE);
 		if (space < resid + clen && uio &&
 		    (atomic || space < so->so_snd.sb_lowat || space < clen)) {
-			if (so->so_state & SS_NBIO)
+			if (so->so_state & SS_NBIO ||
+			    so->so_snd.sb_timeo == (u_long)(-1))
 				snderr(EWOULDBLOCK);
 			sbunlock(&so->so_snd);
 			error = sbwait(&so->so_snd);
@@ -613,7 +615,8 @@
 		}
 		if (uio->uio_resid == 0)
 			goto release;
-		if ((so->so_state & SS_NBIO) || (flags & MSG_DONTWAIT)) {
+		if ((so->so_state & SS_NBIO) || (flags & MSG_DONTWAIT) ||
+		    (so->so_rcv.sb_timeo == (u_long)(-1))) {
 			error = EWOULDBLOCK;
 			goto release;
 		}
@@ -956,11 +959,20 @@
 				goto bad;
 			}
 			tv = mtod(m, struct timeval *);
-			if (tv->tv_sec >= (ULONG_MAX - hz) / hz) {
+			if( tv->tv_sec == (u_long)(-1) &&
+			    tv->tv_usec == (u_long)(-1))
+				val = (u_long)(-1);
+			else if (tv->tv_sec >= (ULONG_MAX - hz) / hz) {
 				error = EDOM;
 				goto bad;
 			}
+			else if (tv->tv_sec == 0 && tv->tv_usec == 0)
+				val = 0;
+			else {
 			val = tv->tv_sec * hz + tv->tv_usec / tick;
+				if(val == 0)
+					val = 1;
+			}
 
 			switch (optname) {
 
diff -Naurb --exclude=CVS --exclude=*.am --exclude=configure --exclude=*.in --exclude=*~ rtems-ss-20010424/c/src/libnetworking/rtems/rtems_glue.c rtems/c/src/libnetworking/rtems/rtems_glue.c
--- rtems-ss-20010424/c/src/libnetworking/rtems/rtems_glue.c	Thu Oct 19 19:33:03 2000
+++ rtems/c/src/libnetworking/rtems/rtems_glue.c	Fri Sep 20 15:09:07 2002
@@ -371,7 +371,15 @@
 	/*
 	 * Wait for the wakeup event.
 	 */
-	sc = rtems_event_receive (SBWAIT_EVENT, RTEMS_EVENT_ANY | RTEMS_WAIT, sb->sb_timeo, &events);
+        if(sb->sb_timeo == (u_long)(-1)) {
+          sc = rtems_event_receive (SBWAIT_EVENT,
+            RTEMS_EVENT_ANY | RTEMS_NO_WAIT, RTEMS_NO_TIMEOUT, &events);
+          if(sc == RTEMS_UNSATISFIED)
+            sc = RTEMS_TIMEOUT;
+        }
+        else
+          sc = rtems_event_receive (SBWAIT_EVENT, RTEMS_EVENT_ANY | RTEMS_WAIT,
+            sb->sb_timeo, &events);
 
 	/*
 	 * Reobtain the network semaphore.
@@ -450,7 +458,15 @@
 	/*
 	 * Wait for the wakeup event.
 	 */
-	sc = rtems_bsdnet_event_receive (SOSLEEP_EVENT, RTEMS_EVENT_ANY | RTEMS_WAIT, so->so_rcv.sb_timeo, &events);
+        if(so->so_rcv.sb_timeo == (u_long)(-1)) {
+          sc = rtems_bsdnet_event_receive (SOSLEEP_EVENT,
+            RTEMS_EVENT_ANY | RTEMS_NO_WAIT, RTEMS_NO_TIMEOUT, &events);
+          if(sc == RTEMS_UNSATISFIED)
+            sc = RTEMS_TIMEOUT;
+        }
+        else
+          sc = rtems_bsdnet_event_receive (SOSLEEP_EVENT,
+            RTEMS_EVENT_ANY | RTEMS_WAIT, so->so_rcv.sb_timeo, &events);
 
 	/*
 	 * Relinquish ownership of the socket.
diff -Naurb --exclude=CVS --exclude=*.am --exclude=configure --exclude=*.in --exclude=*~ rtems-ss-20010424/c/src/libnetworking/rtems/rtems_syscall.c rtems/c/src/libnetworking/rtems/rtems_syscall.c
--- rtems-ss-20010424/c/src/libnetworking/rtems/rtems_syscall.c	Tue Sep  5 19:47:44 2000
+++ rtems/c/src/libnetworking/rtems/rtems_syscall.c	Fri Sep 20 15:09:32 2002
@@ -124,7 +124,9 @@
 		rtems_bsdnet_semaphore_release ();
 		return -1;
 	}
-	if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING)) {
+	if ((so->so_state & SS_NBIO ||
+	     (so->so_rcv.sb_timeo == (u_long)(-1))) &&
+	    (so->so_state & SS_ISCONNECTING)) {
 		errno = EALREADY;
 		rtems_bsdnet_semaphore_release ();
 		return -1;
@@ -138,7 +140,9 @@
 	error = soconnect (so, nam);
 	if (error)
 		goto bad;
-	if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING)) {
+	if (((so->so_state & SS_NBIO) ||
+	      so->so_rcv.sb_timeo == (u_long)(-1)) &&
+	     (so->so_state & SS_ISCONNECTING)) {
 		m_freem(nam);
 		errno = EINPROGRESS;
 		rtems_bsdnet_semaphore_release ();
@@ -200,7 +204,9 @@
 		rtems_bsdnet_semaphore_release ();
 		return -1;
 	}
-        if ((head->so_state & SS_NBIO) && head->so_comp.tqh_first == NULL) {
+	if (((head->so_state & SS_NBIO) ||
+	      head->so_rcv.sb_timeo == (u_long)(-1)) &&
+	     head->so_comp.tqh_first == NULL) {
                 errno = EWOULDBLOCK;
 		rtems_bsdnet_semaphore_release ();
 		return -1;
