Bug 9215 - can't set MTU with ifconfig
Summary: can't set MTU with ifconfig
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: net-tools
Version: 1.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Crutcher Dunnavant
QA Contact:
URL:
Whiteboard:
: 8920 (view as bug list)
Depends On:
Blocks: 8920
TreeView+ depends on / blocked
 
Reported: 2000-02-08 12:44 UTC by Jonathan Kamens
Modified: 2008-05-01 15:37 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2000-10-07 15:11:18 UTC
Embargoed:


Attachments (Terms of Use)
make "ifconfig sl0 mtu 1400" work properly (612 bytes, patch)
2000-02-08 12:45 UTC, Jonathan Kamens
no flags Details | Diff

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")) {



Note You need to log in before you can comment on or make changes to this bug.