NetBSD Problem Report #49043

From www@NetBSD.org  Mon Jul 28 03:21:22 2014
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 07A0EA7E1F
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 28 Jul 2014 03:21:22 +0000 (UTC)
Message-Id: <20140728032120.5CC9EA7E22@mollari.NetBSD.org>
Date: Mon, 28 Jul 2014 03:21:20 +0000 (UTC)
From: ozaki-r@netbsd.org
Reply-To: ozaki-r@netbsd.org
To: gnats-bugs@NetBSD.org
Subject: brconfig bridge0 ipf should not return "Invalid argument" when !BRIDGE_IPF
X-Send-Pr-Version: www-1.0

>Number:         49043
>Category:       kern
>Synopsis:       brconfig bridge0 ipf should not return "Invalid argument" when !BRIDGE_IPF
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 28 03:25:00 +0000 2014
>Closed-Date:    Mon Aug 17 02:22:59 +0000 2020
>Last-Modified:  Mon Aug 17 02:22:59 +0000 2020
>Originator:     Ryota Ozaki
>Release:        current
>Organization:
>Environment:
NetBSD kvm 6.99.49 NetBSD 6.99.49 (KVM) #86: Mon Jul 28 11:58:27 JST 2014  ozaki-r@hidden:/hidden amd64
>Description:
When BRIDGE_IPF isn't enabled in the kernel, brconfig bridge0 ipf shows:
  brconfig: ipf: Invalid argument
but the error isn't appropriate because the argument is valid.

Instead we should show a message something like "the function is not supported".
>How-To-Repeat:
Boot a kernel with BRIDGE_IPF disabled, and run:
  ifconfig bridge0 create
  brconfig bridge0 ipf

>Fix:
brconfig shows "Invalid argument" because the kernel returns EINVAL.
So a simple solution is to let the kernel return ENOTSUP when BRIDGE_IPF
is not enabled. Then brconfig will show "brconfig: ipf: Not supported".
To make the message better, modifying brconfig to check the errno
and show "ipf is not supported in the kernel" or something would be nice.

The following patch is for the simple solution.

diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index 4dec613..816a4bc 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -246,9 +246,9 @@ static int	bridge_ioctl_gma(struct bridge_softc *, void *);
 static int	bridge_ioctl_sma(struct bridge_softc *, void *);
 static int	bridge_ioctl_sifprio(struct bridge_softc *, void *);
 static int	bridge_ioctl_sifcost(struct bridge_softc *, void *);
-#if defined(BRIDGE_IPF)
 static int	bridge_ioctl_gfilt(struct bridge_softc *, void *);
 static int	bridge_ioctl_sfilt(struct bridge_softc *, void *);
+#if defined(BRIDGE_IPF)
 static int	bridge_ipf(void *, struct mbuf **, struct ifnet *, int);
 static int	bridge_ip_checkbasic(struct mbuf **mp);
 # ifdef INET6
@@ -306,10 +306,8 @@ static const struct bridge_control bridge_control_table[] = {
 [BRDGSIFPRIO] = {bridge_ioctl_sifprio, sizeof(struct ifbreq), BC_F_COPYIN|BC_F_SUSER}, 

 [BRDGSIFCOST] = {bridge_ioctl_sifcost, sizeof(struct ifbreq), BC_F_COPYIN|BC_F_SUSER}, 
-#if defined(BRIDGE_IPF)
 [BRDGGFILT] = {bridge_ioctl_gfilt, sizeof(struct ifbrparam), BC_F_COPYOUT},
 [BRDGSFILT] = {bridge_ioctl_sfilt, sizeof(struct ifbrparam), BC_F_COPYIN|BC_F_SUSER},
-#endif /* BRIDGE_IPF */
 };
 static const int bridge_control_table_size = __arraycount(bridge_control_table);

@@ -1277,6 +1275,18 @@ bridge_ioctl_sfilt(struct bridge_softc *sc, void *arg)

 	return (0);
 }
+#else
+static int
+bridge_ioctl_gfilt(struct bridge_softc *sc, void *arg)
+{
+	return ENOTSUP;
+}
+
+static int
+bridge_ioctl_sfilt(struct bridge_softc *sc, void *arg)
+{
+	return ENOTSUP;
+}
 #endif /* BRIDGE_IPF */

 static int

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->feedback
State-Changed-By: prlw1@NetBSD.org
State-Changed-When: Fri, 14 Aug 2020 10:14:43 +0000
State-Changed-Why:
Presumably as the BRIDGE_IPF option has just been removed, this PR can be closed?


From: Ryota Ozaki <ozaki-r@netbsd.org>
To: "gnats-bugs@NetBSD.org" <gnats-bugs@netbsd.org>
Cc: kern-bug-people@netbsd.org, netbsd-bugs@netbsd.org, gnats-admin@netbsd.org, 
	prlw1@netbsd.org
Subject: Re: kern/49043 (brconfig bridge0 ipf should not return "Invalid
 argument" when !BRIDGE_IPF)
Date: Mon, 17 Aug 2020 11:02:36 +0900

 On Fri, Aug 14, 2020 at 7:14 PM <prlw1@netbsd.org> wrote:
 >
 > Synopsis: brconfig bridge0 ipf should not return "Invalid argument" when !BRIDGE_IPF
 >
 > State-Changed-From-To: open->feedback
 > State-Changed-By: prlw1@NetBSD.org
 > State-Changed-When: Fri, 14 Aug 2020 10:14:43 +0000
 > State-Changed-Why:
 > Presumably as the BRIDGE_IPF option has just been removed, this PR can be closed?

 Yes.  I'll close the PR.

 Thanks,
   ozaki-r

State-Changed-From-To: feedback->closed
State-Changed-By: ozaki-r@NetBSD.org
State-Changed-When: Mon, 17 Aug 2020 02:22:59 +0000
State-Changed-Why:
BRIDGE_IPF no longer exists.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: gnats-precook-prs,v 1.4 2018/12/21 14:20:20 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.