Tue Sep 21 14:50:12 2021 UTC ()
don't opencode kauth_cred_get()


(christos)
diff -r1.256 -r1.257 src/sys/dev/ic/wi.c

cvs diff -r1.256 -r1.257 src/sys/dev/ic/wi.c (expand / switch to unified diff)

--- src/sys/dev/ic/wi.c 2021/06/16 00:21:18 1.256
+++ src/sys/dev/ic/wi.c 2021/09/21 14:50:12 1.257
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: wi.c,v 1.256 2021/06/16 00:21:18 riastradh Exp $ */ 1/* $NetBSD: wi.c,v 1.257 2021/09/21 14:50:12 christos Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2004 The NetBSD Foundation, Inc. 4 * Copyright (c) 2004 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Charles M. Hannum. 8 * by Charles M. Hannum.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -89,27 +89,27 @@ @@ -89,27 +89,27 @@
89 * WaveLAN/IEEE cards. Note however that the ISA card isn't really 89 * WaveLAN/IEEE cards. Note however that the ISA card isn't really
90 * anything of the sort: it's actually a PCMCIA bridge adapter 90 * anything of the sort: it's actually a PCMCIA bridge adapter
91 * that fits into an ISA slot, into which a PCMCIA WaveLAN card is 91 * that fits into an ISA slot, into which a PCMCIA WaveLAN card is
92 * inserted. Consequently, you need to use the pccard support for 92 * inserted. Consequently, you need to use the pccard support for
93 * both the ISA and PCMCIA adapters. 93 * both the ISA and PCMCIA adapters.
94 */ 94 */
95 95
96/* 96/*
97 * FreeBSD driver ported to NetBSD by Bill Sommerfeld in the back of the 97 * FreeBSD driver ported to NetBSD by Bill Sommerfeld in the back of the
98 * Oslo IETF plenary meeting. 98 * Oslo IETF plenary meeting.
99 */ 99 */
100 100
101#include <sys/cdefs.h> 101#include <sys/cdefs.h>
102__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.256 2021/06/16 00:21:18 riastradh Exp $"); 102__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.257 2021/09/21 14:50:12 christos Exp $");
103 103
104#define WI_HERMES_AUTOINC_WAR /* Work around data write autoinc bug. */ 104#define WI_HERMES_AUTOINC_WAR /* Work around data write autoinc bug. */
105#define WI_HERMES_STATS_WAR /* Work around stats counter bug. */ 105#define WI_HERMES_STATS_WAR /* Work around stats counter bug. */
106#undef WI_HISTOGRAM 106#undef WI_HISTOGRAM
107#undef WI_RING_DEBUG 107#undef WI_RING_DEBUG
108#define STATIC static 108#define STATIC static
109 109
110 110
111#include <sys/param.h> 111#include <sys/param.h>
112#include <sys/sysctl.h> 112#include <sys/sysctl.h>
113#include <sys/systm.h> 113#include <sys/systm.h>
114#include <sys/callout.h> 114#include <sys/callout.h>
115#include <sys/device.h> 115#include <sys/device.h>
@@ -1449,27 +1449,27 @@ wi_ioctl(struct ifnet *ifp, u_long cmd,  @@ -1449,27 +1449,27 @@ wi_ioctl(struct ifnet *ifp, u_long cmd,
1449 case SIOCDELMULTI: 1449 case SIOCDELMULTI:
1450 if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) { 1450 if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) {
1451 if (ifp->if_flags & IFF_RUNNING) { 1451 if (ifp->if_flags & IFF_RUNNING) {
1452 /* do not rescan */ 1452 /* do not rescan */
1453 error = wi_write_multi(sc); 1453 error = wi_write_multi(sc);
1454 } else 1454 } else
1455 error = 0; 1455 error = 0;
1456 } 1456 }
1457 break; 1457 break;
1458 case SIOCGIFGENERIC: 1458 case SIOCGIFGENERIC:
1459 error = wi_get_cfg(ifp, cmd, data); 1459 error = wi_get_cfg(ifp, cmd, data);
1460 break; 1460 break;
1461 case SIOCSIFGENERIC: 1461 case SIOCSIFGENERIC:
1462 error = kauth_authorize_network(curlwp->l_cred, 1462 error = kauth_authorize_network(kauth_cred_get(),
1463 KAUTH_NETWORK_INTERFACE, 1463 KAUTH_NETWORK_INTERFACE,
1464 KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, ifp, KAUTH_ARG(cmd), 1464 KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, ifp, KAUTH_ARG(cmd),
1465 NULL); 1465 NULL);
1466 if (error) 1466 if (error)
1467 break; 1467 break;
1468 error = wi_set_cfg(ifp, cmd, data); 1468 error = wi_set_cfg(ifp, cmd, data);
1469 if (error == ENETRESET) { 1469 if (error == ENETRESET) {
1470 if (ifp->if_flags & IFF_RUNNING) 1470 if (ifp->if_flags & IFF_RUNNING)
1471 error = wi_init(ifp); 1471 error = wi_init(ifp);
1472 else 1472 else
1473 error = 0; 1473 error = 0;
1474 } 1474 }
1475 break; 1475 break;