From 25fbb2c38c0647f38d3227b80cdd85e4251d7410 Mon Sep 17 00:00:00 2001 From: Yaroslav Tykhiy Date: Sun, 23 May 2004 21:05:08 +0000 Subject: A handler for ioctl(SIOCSIFCAP) should not alter a bit in if_capenable unless the interface driver is actually able to toggle the respective capability on and off. Reviewed by: ru --- sys/dev/dc/if_dc.c | 3 ++- sys/dev/fxp/if_fxp.c | 3 ++- sys/dev/nge/if_nge.c | 3 ++- sys/dev/re/if_re.c | 4 +++- 4 files changed, 9 insertions(+), 4 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c index 01ac05a0e2494..0130b9d7e4d0f 100644 --- a/sys/dev/dc/if_dc.c +++ b/sys/dev/dc/if_dc.c @@ -3708,7 +3708,8 @@ dc_ioctl(struct ifnet *ifp, u_long command, caddr_t data) #endif break; case SIOCSIFCAP: - ifp->if_capenable = ifr->ifr_reqcap; + ifp->if_capenable &= ~IFCAP_POLLING; + ifp->if_capenable |= ifr->ifr_reqcap & IFCAP_POLLING; break; default: error = ether_ioctl(ifp, command, data); diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c index 8a493291e2eb1..d130c1dbaf5cb 100644 --- a/sys/dev/fxp/if_fxp.c +++ b/sys/dev/fxp/if_fxp.c @@ -2496,7 +2496,8 @@ fxp_ioctl(struct ifnet *ifp, u_long command, caddr_t data) break; case SIOCSIFCAP: - ifp->if_capenable = ifr->ifr_reqcap; + ifp->if_capenable &= ~IFCAP_POLLING; + ifp->if_capenable |= ifr->ifr_reqcap & IFCAP_POLLING; break; default: diff --git a/sys/dev/nge/if_nge.c b/sys/dev/nge/if_nge.c index 82b654d334d93..0aa8b851ce950 100644 --- a/sys/dev/nge/if_nge.c +++ b/sys/dev/nge/if_nge.c @@ -2167,7 +2167,8 @@ nge_ioctl(ifp, command, data) } break; case SIOCSIFCAP: - ifp->if_capenable = ifr->ifr_reqcap; + ifp->if_capenable &= ~IFCAP_POLLING; + ifp->if_capenable |= ifr->ifr_reqcap & IFCAP_POLLING; break; default: error = ether_ioctl(ifp, command, data); diff --git a/sys/dev/re/if_re.c b/sys/dev/re/if_re.c index 440a5bed38acc..c28728f144be1 100644 --- a/sys/dev/re/if_re.c +++ b/sys/dev/re/if_re.c @@ -2315,7 +2315,9 @@ re_ioctl(ifp, command, data) error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); break; case SIOCSIFCAP: - ifp->if_capenable = ifr->ifr_reqcap; + ifp->if_capenable &= ~(IFCAP_HWCSUM | IFCAP_POLLING); + ifp->if_capenable |= + ifr->ifr_reqcap & (IFCAP_HWCSUM | IFCAP_POLLING); if (ifp->if_capenable & IFCAP_TXCSUM) ifp->if_hwassist = RE_CSUM_FEATURES; else -- cgit v1.3