DragonFly BSD
DragonFly submit List (threaded) for 2005-05
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

[PATCH] Fix if_sk.c so that dhclient works properly


From: Jeremy Teo <white.wristband@xxxxxxxxx>
Date: Mon, 2 May 2005 12:04:43 +0800

Attached is a simple patch from OpenBSD's rev 1.56 of the sk driver
that fixes some dhclient issues.

For me, it fixed a bug where dhclient couldn't obtain a lease using
the sk driver.

Description of the changes from OpenBSD:

"Don't initialize the card (and start an autonegotiation!) every time
the IP address changes. Makes 'dhclient sk0' invocations way faster
and more consistant. i.e. one DHCPREQUEST elicts the DHCPACK."


Regards,
Jeremy
Index: src/sys/dev/netif/sk/if_sk.c
===================================================================
RCS file: /home/dcvs/src/sys/dev/netif/sk/if_sk.c,v
retrieving revision 1.26
diff -u -3 -r1.26 if_sk.c
--- src/sys/dev/netif/sk/if_sk.c	21 Feb 2005 18:40:37 -0000	1.26
+++ src/sys/dev/netif/sk/if_sk.c	1 May 2005 16:24:47 -0000
@@ -1235,6 +1235,7 @@
 			error = EINVAL;
 		else {
 			ifp->if_mtu = ifr->ifr_mtu;
+			ifp->if_flags &= ~IFF_RUNNING;
 			sk_init(sc_if);
 		}
 		break;
@@ -1257,8 +1258,10 @@
 		break;
 	case SIOCADDMULTI:
 	case SIOCDELMULTI:
-		sk_setmulti(sc_if);
-		error = 0;
+		if (ifp->if_flags & IFF_RUNNING) {
+			sk_setmulti(sc_if);
+			error = 0;
+		}
 		break;
 	case SIOCGIFMEDIA:
 	case SIOCSIFMEDIA:
@@ -1893,6 +1896,7 @@
 	sc_if = ifp->if_softc;
 
 	printf("sk%d: watchdog timeout\n", sc_if->sk_unit);
+	ifp->if_flags &= ~IFF_RUNNING;
 	sk_init(sc_if);
 
 	return;
@@ -2537,6 +2541,11 @@
 	sc = sc_if->sk_softc;
 	mii = device_get_softc(sc_if->sk_miibus);
 
+	if (ifp->if_flags & IFF_RUNNING) {
+		(void)splx(s);
+  		return;
+	}
+
 	/* Cancel pending I/O and free all RX/TX buffers. */
 	sk_stop(sc_if);
 


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]