NetBSD Problem Report #1648

From gnats  Wed Oct 18 12:30:18 1995
Received: from idefix.dachau.marco.de by pain.lcs.mit.edu (8.6.9/8.6.9) with SMTP id MAA28370 for <gnats-bugs@gnats.netbsd.org>; Wed, 18 Oct 1995 12:11:03 -0400
Message-Id: <m0t5b5g-00044kC@robin.dachau.marco.de>
Date: Wed, 18 Oct 95 17:11 MET
From: leo@dachau.marco.de
Reply-To: leo@dachau.marco.de
To: gnats-bugs@gnats.netbsd.org
Subject: changing the mtu is not possible with ifconfig
X-Send-Pr-Version: 3.2

>Number:         1648
>Category:       bin
>Synopsis:       changing the mtu is not possible with ifconfig
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 18 12:35:02 +0000 1995
>Closed-Date:    Thu Apr 10 19:11:15 +0000 1997
>Last-Modified:  Thu Apr 10 19:12:34 +0000 1997
>Originator:     Matthias Pfaller
>Release:        951014
>Organization:
leo@dachau.marco.de			in real life: Matthias Pfaller
marco GmbH, 85221 Dachau, Germany	tel: +49 8131 516142
>Environment:

System: NetBSD robin 1.0A NetBSD 1.0A (ROBIN) #10: Thu Oct 12 10:34:15 MET 1995 leo@robin:/usr/src/sys/arch/i386/compile/ROBIN i386


>Description:
	Changing the MTU of an interface is not possible with ifconfig.
>How-To-Repeat:
>Fix:
The following patch allows ifconfig to change the MTU and documents the
new option.
--- ifconfig.8.orig	Fri Jun 23 13:48:52 1995
+++ ifconfig.8	Fri Jun 23 13:47:35 1995
@@ -176,6 +176,10 @@
 Higher metrics have the effect of making a route
 less favorable; metrics are counted as addition hops
 to the destination network or host.
+.It Cm mtu Ar n
+Set the maximum transmission unit of the interface to
+.Ar n .
+Most interfaces don't support this option.
 .It Cm netmask Ar mask
 (Inet and ISO)
 Specify how much of the address to reserve for subdividing
--- ifconfig.c.orig	Sat Oct 14 02:10:15 1995
+++ ifconfig.c	Wed Oct 18 17:09:36 1995
@@ -79,7 +79,7 @@
 struct	iso_aliasreq	iso_addreq;
 struct	sockaddr_in	netmask;
 char	name[30];
-int	flags, metric, setaddr, setipdst, doalias;
+int	flags, metric, mtu, setaddr, setipdst, doalias;
 int	clearaddr, s;
 int	newaddr = 1;
 int	nsellength = 1;
@@ -93,6 +93,7 @@
 void 	setifbroadaddr __P((char *));
 void 	setifipdst __P((char *));
 void 	setifmetric __P((char *));
+void 	setifmtu __P((char *));
 void 	setifnetmask __P((char *));
 void 	setnsellength __P((char *));
 void 	setsnpaoffset __P((char *));
@@ -311,6 +312,10 @@
 		metric = 0;
 	} else
 		metric = ifr->ifr_metric;
+	if (ioctl(s, SIOCGIFMTU, (caddr_t)ifr) < 0)
+		mtu = 0;
+	else
+		mtu = ifr->ifr_metric;
 	return (0);
 }

@@ -475,6 +480,8 @@
 	printb("flags", flags, IFFBITS);
 	if (metric)
 		printf(" metric %d", metric);
+	if (mtu)
+		printf(" mtu %d", mtu);
 	putchar('\n');
 	if ((p = afp) != NULL) {
 		(*p->af_status)(1);
@@ -746,6 +753,16 @@
 }

 void
+setifmtu(val)
+	char *val;
+{
+	strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name));
+	ifr.ifr_metric = atoi(val);
+	if (ioctl(s, SIOCSIFMTU, (caddr_t)&ifr) < 0)
+		warn("SIOCSIFMTU");
+}
+
+void
 setsnpaoffset(val)
 	char *val;
 {
@@ -785,10 +802,11 @@
 void
 usage()
 {
-	fprintf(stderr, "usage: ifconfig interface\n%s%s%s%s%s%s",
+	fprintf(stderr, "usage: ifconfig interface\n%s%s%s%s%s%s%s",
 		"\t[ af [ address [ dest_addr ] ] [ up ] [ down ] ",
 		"[ netmask mask ] ]\n",
 		"\t[ metric n ]\n",
+		"\t[ mtu n ]\n",
 		"\t[ arp | -arp ]\n",
 		"\t[ link0 | -link0 ] [ link1 | -link1 ] [ link2 | -link2 ]\n",
 		"       ifconfig -a [ af ]\n");
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: is 
State-Changed-When: Thu Apr 10 12:11:15 PDT 1997 
State-Changed-Why:  
Applied patch with some necessary changes. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.