From owner-svn-src-projects@FreeBSD.ORG Mon Apr 6 06:44:50 2015 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 26CF8AE7; Mon, 6 Apr 2015 06:44:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 077ECAF3; Mon, 6 Apr 2015 06:44:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t366inQZ034791; Mon, 6 Apr 2015 06:44:49 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t366in5D034790; Mon, 6 Apr 2015 06:44:49 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201504060644.t366in5D034790@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 6 Apr 2015 06:44:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r281137 - projects/ifnet/sys/netgraph X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Apr 2015 06:44:50 -0000 Author: glebius Date: Mon Apr 6 06:44:48 2015 New Revision: 281137 URL: https://svnweb.freebsd.org/changeset/base/281137 Log: - Make ng_iface(4) again compilable. - Remove unused commands. Sponsored by: Nginx, Inc. Modified: projects/ifnet/sys/netgraph/ng_iface.c Modified: projects/ifnet/sys/netgraph/ng_iface.c ============================================================================== --- projects/ifnet/sys/netgraph/ng_iface.c Mon Apr 6 06:02:58 2015 (r281136) +++ projects/ifnet/sys/netgraph/ng_iface.c Mon Apr 6 06:44:48 2015 (r281137) @@ -110,6 +110,7 @@ struct ng_iface_private { if_t ifp; /* Our interface */ u_int fib; /* Interface fib */ int unit; /* Interface unit number */ + uint32_t flags; /* Interface flags */ node_p node; /* Our netgraph node */ hook_p hooks[NUM_FAMILIES]; /* Hook for each address family */ }; @@ -283,10 +284,8 @@ ng_iface_ioctl(if_t ifp, u_long command, ng_iface_print_ioctl(ifp, command, data); #endif switch (command) { - - /* These two are mostly handled at a higher layer */ - case SIOCSIFADDR: - if_addflags(ifp, IF_FLAGS, IFF_UP); + case SIOCSIFFLAGS: + priv->flags = ifr->ifr_flags; break; /* Set the interface MTU */ @@ -303,7 +302,6 @@ ng_iface_ioctl(if_t ifp, u_long command, /* Stuff that's not supported */ case SIOCGIFADDR: - case SIOCSIFFLAGS: case SIOCADDMULTI: case SIOCDELMULTI: break; @@ -325,11 +323,12 @@ static int ng_iface_output(if_t ifp, struct mbuf *m, const struct sockaddr *dst, struct route *ro) { + const priv_p priv = if_getsoftc(ifp, IF_DRIVER_SOFTC); struct m_tag *mtag; uint32_t af; /* Check interface flags */ - if ((if_get(ifp, IF_FLAGS) & IFF_UP) == 0) { + if ((priv->flags & IFF_UP) == 0) { m_freem(m); return (ENETDOWN); } @@ -482,6 +481,7 @@ ng_iface_constructor(node_p node) priv->node = node; ifat.ifat_softc = priv; ifat.ifat_dunit = priv->unit = alloc_unr(V_ng_iface_unit); + priv->flags = ifat.ifat_flags; priv->ifp = if_attach(&ifat); /* Give this node the same name as the interface (if possible) */ @@ -537,28 +537,6 @@ ng_iface_rcvmsg(node_p node, item_p item strlcpy(resp->data, if_name(ifp), IFNAMSIZ); break; - case NGM_IFACE_POINT2POINT: - case NGM_IFACE_BROADCAST: - { - - /* Deny request if interface is UP */ - if ((if_get(ifp, IF_FLAGS) & IFF_UP) != 0) - return (EBUSY); - - /* Change flags */ - switch (msg->header.cmd) { - case NGM_IFACE_POINT2POINT: - if_addflags(ifp, IF_FLAGS, IFF_POINTOPOINT); - if_clrflags(ifp, IF_FLAGS, IFF_BROADCAST); - break; - case NGM_IFACE_BROADCAST: - if_clrflags(ifp, IF_FLAGS, IFF_POINTOPOINT); - if_addflags(ifp, IF_FLAGS, IFF_BROADCAST); - break; - } - break; - } - case NGM_IFACE_GET_IFINDEX: { struct ifreq ifr; @@ -616,7 +594,7 @@ ng_iface_rcvdata(hook_p hook, item_p ite /* Sanity checks */ KASSERT(iffam != NULL, ("%s: iffam", __func__)); M_ASSERTPKTHDR(m); - if ((if_get(ifp, IF_FLAGS) & IFF_UP) == 0) { + if ((priv->flags & IFF_UP) == 0) { NG_FREE_M(m); return (ENETDOWN); }