Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Sep 1997 03:48:27 -0700 (PDT)
From:      muir@idiom.com
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/4518: ipfw cannot handle 6-character interface names
Message-ID:  <199709121048.DAA00860@ping.idiom.com>
Resent-Message-ID: <199709121050.DAA24384@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         4518
>Category:       bin
>Synopsis:       ipfw cannot handle 6-character interface names
>Confidential:   No
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Sep 12 03:50:00 PDT 1997
>Last-Modified:
>Originator:     David Sharnoff
>Organization:
Idiom
>Release:        FreeBSD 2.2.2-RELEASE i386
>Environment:

	FreeBSD 2.2.2 with an ET Inc serial card doing frame relay.
	Example interface name:

		ethb17

>Description:

	ipfw chops off the last character of 6-letter interface
	names.  "ethb17" becomes "ethb1"

>How-To-Repeat:

	ipfw add allow ip from 140.174.82.0/24 to any out via ethb17

>Fix:


*** ipfw.c	Wed Mar  5 04:30:08 1997
--- ../../ipfw.c	Fri Sep 12 03:41:32 1997
***************
*** 612,620 ****
  	 *	If a unit was specified, check for that exact interface.
  	 *	If a wildcard was specified, check for unit 0.
  	 */
! 	snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%s%d", 
! 			 rule->fw_via_name,
! 			 rule->fw_flg & IP_FW_F_IFUWILD ? 0 : rule->fw_via_unit);
  
  	if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0)
  		return(-1);	/* interface isn't recognized by the kernel */
--- 612,622 ----
  	 *	If a unit was specified, check for that exact interface.
  	 *	If a wildcard was specified, check for unit 0.
  	 */
! 	char ifnb[FW_IFNLEN+1];
! 	strncpy(ifnb,rule->fw_via_name,FW_IFNLEN);
! 	ifnb[FW_IFNLEN]='\0';
! 	snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%s%d", ifnb,
! 		 rule->fw_flg & IP_FW_F_IFUWILD ? 0 : rule->fw_via_unit);
  
  	if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0)
  		return(-1);	/* interface isn't recognized by the kernel */
***************
*** 739,745 ****
  				char *q;
  
  				strncpy(rule.fw_via_name, *av, sizeof(rule.fw_via_name));
- 				rule.fw_via_name[sizeof(rule.fw_via_name) - 1] = '\0';
  				for (q = rule.fw_via_name; *q && !isdigit(*q) && *q != '*'; q++)
  					continue;
  				if (*q == '*')
--- 741,746 ----
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199709121048.DAA00860>