From owner-p4-projects@FreeBSD.ORG Wed Oct 4 20:12:03 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B7F0D16A47C; Wed, 4 Oct 2006 20:12:03 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 85B2016A40F for ; Wed, 4 Oct 2006 20:12:03 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0C8B543D76 for ; Wed, 4 Oct 2006 20:11:59 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k94KBxRS074687 for ; Wed, 4 Oct 2006 20:11:59 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k94KBxUk074684 for perforce@freebsd.org; Wed, 4 Oct 2006 20:11:59 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Wed, 4 Oct 2006 20:11:59 GMT Message-Id: <200610042011.k94KBxUk074684@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Cc: Subject: PERFORCE change 107261 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Oct 2006 20:12:04 -0000 http://perforce.freebsd.org/chv.cgi?CH=107261 Change 107261 by rwatson@rwatson_zoo on 2006/10/04 20:11:22 Keep comments about layering, but switch to priv(9). Affected files ... .. //depot/projects/trustedbsd/priv/sys/net/if_gre.c#3 edit Differences ... ==== //depot/projects/trustedbsd/priv/sys/net/if_gre.c#3 (text+ko) ==== @@ -457,7 +457,7 @@ * XXXRW: Isn't this suser() redundant to the ifnet layer * check? */ - if ((error = suser(curthread)) != 0) + if ((error = priv_check(curthread, PRIV_NET_SETIFFLAGS)) != 0) break; if ((ifr->ifr_flags & IFF_LINK0) != 0) sc->g_proto = IPPROTO_GRE; @@ -473,7 +473,7 @@ * XXXRW: Isn't this suser() redundant to the ifnet layer * check? */ - if ((error = suser(curthread)) != 0) + if ((error = priv_check(curthread, PRIV_NET_SETIFMTU)) != 0) break; if (ifr->ifr_mtu < 576) { error = EINVAL; @@ -485,12 +485,36 @@ ifr->ifr_mtu = GRE2IFP(sc)->if_mtu; break; case SIOCADDMULTI: + /* + * XXXRW: Isn't this suser() redundant to the ifnet layer + * check? + */ + if ((error = priv_check(curthread, PRIV_NET_ADDMULTI)) != 0) + break; + if (ifr == 0) { + error = EAFNOSUPPORT; + break; + } + switch (ifr->ifr_addr.sa_family) { +#ifdef INET + case AF_INET: + break; +#endif +#ifdef INET6 + case AF_INET6: + break; +#endif + default: + error = EAFNOSUPPORT; + break; + } + break; case SIOCDELMULTI: /* * XXXRW: Isn't this suser() redundant to the ifnet layer * check? */ - if ((error = suser(curthread)) != 0) + if ((error = priv_check(curthread, PRIV_NET_DELIFGROUP)) != 0) break; if (ifr == 0) { error = EAFNOSUPPORT; @@ -515,7 +539,7 @@ * XXXRW: Isn't this suser() redundant to the ifnet layer * check? */ - if ((error = suser(curthread)) != 0) + if ((error = priv_check(curthread, PRIV_NET_GRE)) != 0) break; sc->g_proto = ifr->ifr_flags; switch (sc->g_proto) { @@ -606,7 +630,7 @@ * XXXRW: Isn't this suser() redundant to the ifnet layer * check? */ - if ((error = suser(curthread)) != 0) + if ((error = priv_check(curthread, PRIV_NET_SETIFPHYS)) != 0) break; if (aifr->ifra_addr.sin_family != AF_INET || aifr->ifra_dstaddr.sin_family != AF_INET) { @@ -626,7 +650,7 @@ * XXXRW: Isn't this suser() redundant to the ifnet layer * check? */ - if ((error = suser(curthread)) != 0) + if ((error = priv_check(curthread, PRIV_NET_SETIFPHYS)) != 0) break; if (lifr->addr.ss_family != AF_INET || lifr->dstaddr.ss_family != AF_INET) { @@ -647,7 +671,7 @@ * XXXRW: Isn't this suser() redundant to the ifnet layer * check? */ - if ((error = suser(curthread)) != 0) + if ((error = priv_check(curthread, PRIV_NET_SETIFPHYS)) != 0) break; sc->g_src.s_addr = INADDR_ANY; sc->g_dst.s_addr = INADDR_ANY;