From dunstan@freebsd.czest.pl  Sat May 21 23:47:10 2005
Return-Path: <dunstan@freebsd.czest.pl>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id DE29416A41C
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 21 May 2005 23:47:10 +0000 (GMT)
	(envelope-from dunstan@freebsd.czest.pl)
Received: from freebsd.czest.pl (silver.iplus.pl [80.48.250.4])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 57DE743D1F
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 21 May 2005 23:47:09 +0000 (GMT)
	(envelope-from dunstan@freebsd.czest.pl)
Received: from freebsd.czest.pl (freebsd.czest.pl [80.48.250.4])
	by freebsd.czest.pl (8.12.10/8.12.9) with ESMTP id j4LNw7Lh043522
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 21 May 2005 23:58:08 GMT
	(envelope-from dunstan@freebsd.czest.pl)
Received: (from dunstan@localhost)
	by freebsd.czest.pl (8.12.10/8.12.9/Submit) id j4LNw7fo043521;
	Sat, 21 May 2005 23:58:07 GMT
	(envelope-from dunstan)
Message-Id: <200505212358.j4LNw7fo043521@freebsd.czest.pl>
Date: Sat, 21 May 2005 23:58:07 GMT
From: "Wojciech A. Koszek" <dunstan@freebsd.czest.pl>
Reply-To: "Wojciech A. Koszek" <dunstan@freebsd.czest.pl>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] Wrong error code is returned in ng_eiface(4)
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         81349
>Category:       kern
>Synopsis:       [PATCH] Wrong error code is returned in ng_eiface(4)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    glebius
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat May 21 23:50:02 GMT 2005
>Closed-Date:    Mon May 23 13:43:00 GMT 2005
>Last-Modified:  Mon May 23 13:43:00 GMT 2005
>Originator:     Wojciech A. Koszek
>Release:        FreeBSD 5.4-STABLE i386
>Organization:
>Environment:
System: FreeBSD dunstan.freebsd.czest.pl 5.4-STABLE FreeBSD 5.4-STABLE #5: Sun May 8 11:57:11 CEST 2005 dunstan@dunstan.freebsd.czest.pl:/usr/obj/usr/src/sys/HOME8 i386


>Description:
Other Netgraph nodes return EINVAL when we try to create hook with name
which is not handled (of course, for modules which functionality rely on
hooks' names). Currently, ng_eiface(4) returns EPFNOSUPPORT, which is less
obvious while being configurated than proper -- EINVAL.

>How-To-Repeat:
# ngctl
[..]
+ mkpeer . eiface input xXxX
ngctl: send msg: Protocol family not supported

('xXxX' instead of 'ether', which is required for ng_eiface(4)).

>Fix:
Patch [diff.0.ng_eiface.c] replaces EPFNOSUPPORT with EINVAL.

--- diff.0.ng_eiface.c begins here ---
Index: src/sys/netgraph/ng_eiface.c
===================================================================
RCS file: /home/ncvs/src/sys/netgraph/ng_eiface.c,v
retrieving revision 1.31
diff -r1.31 ng_eiface.c
384c384
< 		return (EPFNOSUPPORT);
---
> 		return (EINVAL);
--- diff.0.ng_eiface.c ends here ---
>Release-Note:
>Audit-Trail:

From: "Wojciech A. Koszek" <dunstan@freebsd.czest.pl>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/81349: [PATCH] Wrong error code is returned in ng_eiface(4)
Date: Sun, 22 May 2005 10:35:05 +0000

 --GvXjxJ+pjyke8COw
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 Hello,
 
 I've noticed error returned in other Netgraph nodes when we
 create hook with improper name differs without any reason.
 Attachement contains patch which fixes inconsistency.
 
 -- 
 * Wojciech A. Koszek && dunstan@FreeBSD.czest.pl
 
 --GvXjxJ+pjyke8COw
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename=NG-errorcode
 
 Index: ng_eiface.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/netgraph/ng_eiface.c,v
 retrieving revision 1.31
 diff -r1.31 ng_eiface.c
 384c384
 < 		return (EPFNOSUPPORT);
 ---
 > 		return (EINVAL);
 Index: ng_gif_demux.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/netgraph/ng_gif_demux.c,v
 retrieving revision 1.10
 diff -r1.10 ng_gif_demux.c
 263c263
 < 			return (EPFNOSUPPORT);
 ---
 > 			return (EINVAL);
 Index: ng_iface.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/netgraph/ng_iface.c,v
 retrieving revision 1.41
 diff -r1.41 ng_iface.c
 527c527
 < 		return (EPFNOSUPPORT);
 ---
 > 		return (EINVAL);
 Index: ng_split.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/netgraph/ng_split.c,v
 retrieving revision 1.5
 diff -r1.5 ng_split.c
 116c116
 < 		return (EPFNOSUPPORT);
 ---
 > 		return (EINVAL);
 
 --GvXjxJ+pjyke8COw--
State-Changed-From-To: open->closed 
State-Changed-By: glebius 
State-Changed-When: Mon May 23 13:39:34 GMT 2005 
State-Changed-Why:  
In these nodes (iface, eiface, gif_demux) hooks are named by protocol 
names, that's why this error code is logically correct. 

However, in ng_split this is probably a cut'n'paste error. Fixed, 
thanks. 


Responsible-Changed-From-To: freebsd-bugs->glebius 
Responsible-Changed-By: glebius 
Responsible-Changed-When: Mon May 23 13:39:34 GMT 2005 
Responsible-Changed-Why:  
Mine. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=81349 
>Unformatted:
