Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 9215

Summary: can't set MTU with ifconfig
Product: [Retired] Red Hat Raw Hide Reporter: Jonathan Kamens <h1k6zn2m>
Component: net-toolsAssignee: Crutcher Dunnavant <crutcher>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 1.0CC: ecki
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-10-07 15:11:18 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 8920    
Attachments:
Description Flags
make "ifconfig sl0 mtu 1400" work properly none

Description Jonathan Kamens 2000-02-08 12:44:50 UTC
Bug number 8920 is correct -- there is a problem setting the MTU (and
various other settings) with ifconfig in net-tools-1.54-3.

First of all, ifconfig does not correctly use the "inet" address family by
default, even though the documentation says that it should.

Second, it does not use the correct socket when setting the MTU on an inet
device.

The attached patch fixes both of these problems.

Comment 1 Jonathan Kamens 2000-02-08 12:45:59 UTC
Created attachment 100 [details]
make "ifconfig sl0 mtu 1400" work properly

Comment 2 Jeff Johnson 2000-10-07 15:11:12 UTC
*** Bug 8920 has been marked as a duplicate of this bug. ***

Comment 3 Jeff Johnson 2000-10-07 16:18:02 UTC
Fixed (patch added) in net-tools-1.57-1. Thanks for the patch.

Comment 4 Bernd Eckenfels 2000-10-08 00:28:20 UTC
i put the atached fix into net-tools upstream CVS.



Comment 5 Bernd Eckenfels 2000-10-08 00:31:40 UTC
actually i tried to attach one, was not possible, so here it iis, and you can
find it on vger and in the next upstream release.

diff -u -r1.41 ifconfig.c
--- ifconfig.c  2000/08/14 07:57:19     1.41
+++ ifconfig.c  2000/10/08 00:43:55
@@ -20,6 +20,8 @@
  * {1.34} - 19980630 - Arnaldo Carvalho de Melo <acme.br>
  *                     - gettext instead of catgets for i18n
  *          10/1998  - Andi Kleen. Use interface list primitives.
+ *         20001008 - Bernd Eckenfels, Patch from RH for setting mtu
+ *                     (default AF was wrong)
  */

 #define DFLT_AF "inet"
@@ -252,11 +254,6 @@
     textdomain("net-tools");
 #endif

-    /* Create a channel to the NET kernel. */
-    if ((skfd = sockets_open(0)) < 0) {
-       perror("socket");
-       exit(1);
-    }

     /* Find any options. */
     argc--;
@@ -289,6 +286,12 @@
        argc--;
     }

+    /* Create a channel to the NET kernel. */
+    if ((skfd = sockets_open(0)) < 0) {
+       perror("socket");
+       exit(1);
+    }
+
     /* Do we have to show the current setup? */
     if (argc == 0) {
        int err = if_print((char *) NULL);
@@ -304,19 +307,22 @@
        exit(err < 0);
     }
     /* The next argument is either an address family name, or an option. */
-    if ((ap = get_aftype(*spp)) == NULL)
+    if ((ap = get_aftype(*spp)) != NULL)
+       spp++; /* it was a AF name */
+    else
        ap = get_aftype(DFLT_AF);
-    else {
-       /* XXX: should print the current setup if no args left, but only
-          for this family */
-       spp++;
+
+    if(ap) {
        addr_family = ap->af;
+       if ((fd=sockets_open(addr_family)) < 0) {
+               perror("family socket");
+               exit(1);
+       } else {
+               if (skfd) close(skfd);
+               skfd = fd;
+       }
     }

-    if (sockets_open(addr_family) < 0) {
-       perror("family socket");
-       exit(1);
-    }
     /* Process the remaining arguments. */
     while (*spp != (char *) NULL) {
        if (!strcmp(*spp, "arp")) {