From owner-freebsd-bugs Fri Sep 12 03:50:08 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id DAA24390 for bugs-outgoing; Fri, 12 Sep 1997 03:50:08 -0700 (PDT) Received: (from gnats@localhost) by hub.freebsd.org (8.8.7/8.8.7) id DAA24384; Fri, 12 Sep 1997 03:50:01 -0700 (PDT) Resent-Date: Fri, 12 Sep 1997 03:50:01 -0700 (PDT) Resent-Message-Id: <199709121050.DAA24384@hub.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@FreeBSD.ORG, muir@idiom.com Received: from ping.idiom.com (idiom-frVT1-gw.sf.tlg.net [140.174.37.22] (may be forged)) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id DAA24318 for ; Fri, 12 Sep 1997 03:48:30 -0700 (PDT) Received: (from muir@localhost) by ping.idiom.com (8.8.5/8.8.5) id DAA00860; Fri, 12 Sep 1997 03:48:27 -0700 (PDT) Message-Id: <199709121048.DAA00860@ping.idiom.com> Date: Fri, 12 Sep 1997 03:48:27 -0700 (PDT) From: muir@idiom.com Reply-To: muir@idiom.com To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: bin/4518: ipfw cannot handle 6-character interface names Sender: owner-freebsd-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >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: