SOURCES: net-tools-branch.diff - fix diff by rediffing
glen
glen at pld-linux.org
Tue Sep 11 21:42:43 CEST 2007
Author: glen Date: Tue Sep 11 19:42:43 2007 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- fix diff by rediffing
---- Files affected:
SOURCES:
net-tools-branch.diff (1.2 -> 1.3)
---- Diffs:
================================================================
Index: SOURCES/net-tools-branch.diff
diff -u SOURCES/net-tools-branch.diff:1.2 SOURCES/net-tools-branch.diff:1.3
--- SOURCES/net-tools-branch.diff:1.2 Tue Sep 11 21:30:33 2007
+++ SOURCES/net-tools-branch.diff Tue Sep 11 21:42:38 2007
@@ -783,7 +783,7 @@
extern void ife_print(struct interface *ptr);
extern int ife_short;
---- net-tools-1.60/include/mii.h 2007-09-11 22:16:48.918154249 +0300
+--- net-tools-1.60/include/mii.h 2000-05-21 16:21:27.000000000 +0200
+++ net-tools/include/mii.h 2006-09-27 23:59:19.000000000 +0300
@@ -6,11 +6,14 @@
* Copyright (C) 2000 David A. Hinds -- dhinds at pcmcia.sourceforge.org
@@ -802,11 +802,32 @@
#define SIOCGMIIPHY (SIOCDEVPRIVATE) /* Read from current PHY */
#define SIOCGMIIREG (SIOCDEVPRIVATE+1) /* Read any PHY register */
#define SIOCSMIIREG (SIOCDEVPRIVATE+2) /* Write any PHY register */
-@@ -97,4 +100,4 @@
- /* Last register we need for show_basic_mii() */
- #define MII_BASIC_MAX (MII_STAT1000+1)
+@@ -38,6 +41,7 @@
+ #define MII_BMCR_RESTART 0x0200
+ #define MII_BMCR_DUPLEX 0x0100
+ #define MII_BMCR_COLTEST 0x0080
++#define MII_BMCR_SPEED1000 0x0040
+
+ /* Basic Mode Status Register */
+ #define MII_BMSR 0x01
+@@ -83,4 +87,17 @@
+ #define MII_ANER_PAGE_RX 0x0002
+ #define MII_ANER_LP_AN_ABLE 0x0001
-#endif /* _LINUX_MII_H */
++#define MII_CTRL1000 0x09
++#define MII_BMCR2_1000FULL 0x0200
++#define MII_BMCR2_1000HALF 0x0100
++
++#define MII_STAT1000 0x0a
++#define MII_LPA2_1000LOCALOK 0x2000
++#define MII_LPA2_1000REMRXOK 0x1000
++#define MII_LPA2_1000FULL 0x0800
++#define MII_LPA2_1000HALF 0x0400
++
++/* Last register we need for show_basic_mii() */
++#define MII_BASIC_MAX (MII_STAT1000+1)
++
+#endif /* _NETTOOLS_MII_H */
--- net-tools-1.60/include/util-ank.h 1999-04-21 20:38:05.000000000 +0300
+++ net-tools/include/util-ank.h 2006-10-11 04:14:33.000000000 +0300
@@ -958,6 +979,164 @@
(ptr[0] & 0377), (ptr[1] & 0377), (ptr[2] & 0377),
(ptr[3] & 0377), (ptr[4] & 0377), (ptr[5] & 0377)
);
+--- net-tools-1.60/lib/eui64.c 1970-01-01 03:00:00.000000000 +0300
++++ net-tools/lib/eui64.c 2001-11-12 04:12:05.000000000 +0200
+@@ -0,0 +1,155 @@
++/*
++ * lib/eui64.c This file contains support for generic EUI-64 hw addressing
++ *
++ * Version: $Id$
++ *
++ * Author: Daniel Stodden <stodden at in.tum.de>
++ * Copyright 2001 Daniel Stodden
++ *
++ * blueprinted from ether.c
++ * Copyright 1993 MicroWalt Corporation
++ *
++ * This program is free software; you can redistribute it
++ * and/or modify it under the terms of the GNU General
++ * Public License as published by the Free Software
++ * Foundation; either version 2 of the License, or (at
++ * your option) any later version.
++ */
++#include "config.h"
++
++#if HAVE_HWEUI64
++
++#include <sys/types.h>
++#include <sys/ioctl.h>
++#include <sys/socket.h>
++#include <net/if_arp.h>
++#include <stdlib.h>
++#include <stdio.h>
++#include <ctype.h>
++#include <errno.h>
++#include <fcntl.h>
++#include <string.h>
++#include <termios.h>
++#include <unistd.h>
++#include "net-support.h"
++#include "pathnames.h"
++#include "intl.h"
++
++/*
++ * EUI-64 constants
++ */
++
++#define EUI64_ALEN 8
++
++#ifndef ARPHRD_EUI64
++#define ARPHRD_EUI64 27
++#warning "ARPHRD_EUI64 not defined in <net/if_arp.h>. Using private value 27"
++#endif
++
++struct hwtype eui64_hwtype;
++
++/* Display an EUI-64 address in readable format. */
++static char *pr_eui64( unsigned char *ptr )
++{
++ static char buff[64];
++
++ snprintf(buff, sizeof(buff), "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",
++ (ptr[0] & 0377), (ptr[1] & 0377), (ptr[2] & 0377), (ptr[3] & 0377),
++ (ptr[4] & 0377), (ptr[5] & 0377), (ptr[6] & 0377), (ptr[7] & 0377)
++ );
++ return (buff);
++}
++
++/* Start the PPP encapsulation on the file descriptor. */
++static int in_eui64( char *bufp, struct sockaddr *sap )
++{
++ unsigned char *ptr;
++ char c, *orig;
++ int i;
++ unsigned val;
++
++ sap->sa_family = eui64_hwtype.type;
++ ptr = sap->sa_data;
++
++ i = 0;
++ orig = bufp;
++
++ while ((*bufp != '\0') && (i < EUI64_ALEN)) {
++ val = 0;
++ c = *bufp++;
++ if (isdigit(c))
++ val = c - '0';
++ else if (c >= 'a' && c <= 'f')
++ val = c - 'a' + 10;
++ else if (c >= 'A' && c <= 'F')
++ val = c - 'A' + 10;
++ else {
++#ifdef DEBUG
++ fprintf( stderr, _("in_eui64(%s): invalid eui64 address!\n"),
++ orig );
++#endif
++ errno = EINVAL;
++ return (-1);
++ }
++
++ val <<= 4;
++ c = *bufp;
++ if (isdigit(c))
++ val |= c - '0';
++ else if (c >= 'a' && c <= 'f')
++ val |= c - 'a' + 10;
++ else if (c >= 'A' && c <= 'F')
++ val |= c - 'A' + 10;
++ else if (c == ':' || c == 0)
++ val >>= 4;
++ else {
++#ifdef DEBUG
++ fprintf( stderr, _("in_eui64(%s): invalid eui64 address!\n"),
++ orig );
++#endif
++ errno = EINVAL;
++ return (-1);
++ }
++
++ if (c != 0)
++ bufp++;
++
++ *ptr++ = (unsigned char) (val & 0377);
++ i++;
++
++ /* We might get a semicolon here - not required. */
++ if (*bufp == ':') {
++ if (i == EUI64_ALEN) {
++#ifdef DEBUG
++ fprintf(stderr, _("in_eui64(%s): trailing : ignored!\n"),
++ orig)
++#endif
++ ; /* nothing */
++ }
++ bufp++;
++ }
++ }
++
++ /* That's it. Any trailing junk? */
++ if ((i == EUI64_ALEN) && (*bufp != '\0')) {
++#ifdef DEBUG
++ fprintf(stderr, _("in_eui64(%s): trailing junk!\n"), orig);
++ errno = EINVAL;
++ return (-1);
++#endif
++ }
++#ifdef DEBUG
++ fprintf(stderr, "in_eui64(%s): %s\n", orig, pr_eui64(sap->sa_data));
++#endif
++
++ return (0);
++}
++
++struct hwtype eui64_hwtype =
++{
++ "eui64", NULL, /*"EUI-64 addressing", */ ARPHRD_EUI64, EUI64_ALEN,
++ pr_eui64, in_eui64, NULL, 0
++};
++
++
++#endif /* HAVE_EUI64 */
--- net-tools-1.60/lib/hw.c 2000-05-20 20:27:25.000000000 +0200
+++ net-tools/lib/hw.c 2001-11-12 04:12:05.000000000 +0200
@@ -2,7 +2,7 @@
@@ -2867,6 +3046,308 @@
para a maioria das classes você pode assumir que a apresentação usual pode
ser usada. Para a classe Ethernet, são 6 bytes em hexadecimal, separados
por dois pontos (:).
+--- net-tools-1.60/mii-tool.c 2000-05-21 16:31:17.000000000 +0200
++++ net-tools/mii-tool.c 2006-09-27 23:59:18.000000000 +0300
+@@ -29,8 +29,7 @@
+ http://www.national.com/pf/DP/DP83840.html
+ */
+
+-static char version[] =
+-"mii-tool.c 1.9 2000/04/28 00:56:08 (David Hinds)\n";
++static char Version[] = "$Id$\n(Author: David Hinds based on Donald Becker's mii-diag)";
+
+ #include <unistd.h>
+ #include <stdlib.h>
+@@ -46,16 +45,19 @@
+ #include <sys/socket.h>
+ #include <sys/ioctl.h>
+ #include <net/if.h>
++#include <linux/sockios.h>
++
+ #ifndef __GLIBC__
+ #include <linux/if_arp.h>
+ #include <linux/if_ether.h>
+ #endif
+ #include "mii.h"
++#include "version.h"
+
+ #define MAX_ETH 8 /* Maximum # of interfaces */
+
+ /* Table of known MII's */
+-static struct {
++static const struct {
+ u_short id1, id2;
+ char *name;
+ } mii_id[] = {
+@@ -74,6 +76,9 @@
+ { 0x0181, 0x4410, "Quality QS6612" },
+ { 0x0282, 0x1c50, "SMSC 83C180" },
+ { 0x0300, 0xe540, "TDK 78Q2120" },
++ { 0x0141, 0x0c20, "Yukon 88E1011" },
++ { 0x0141, 0x0cc0, "Yukon-EC 88E1111" },
++ { 0x0141, 0x0c90, "Yukon-2 88E1112" },
+ };
+ #define NMII (sizeof(mii_id)/sizeof(mii_id[0]))
+
+@@ -137,40 +142,48 @@
+
+ const struct {
+ char *name;
+- u_short value;
++ u_short value[2];
+ } media[] = {
+ /* The order through 100baseT4 matches bits in the BMSR */
+- { "10baseT-HD", MII_AN_10BASET_HD },
+- { "10baseT-FD", MII_AN_10BASET_FD },
+- { "100baseTx-HD", MII_AN_100BASETX_HD },
+- { "100baseTx-FD", MII_AN_100BASETX_FD },
+- { "100baseT4", MII_AN_100BASET4 },
+- { "100baseTx", MII_AN_100BASETX_FD | MII_AN_100BASETX_HD },
+- { "10baseT", MII_AN_10BASET_FD | MII_AN_10BASET_HD },
++ { "10baseT-HD", {MII_AN_10BASET_HD} },
++ { "10baseT-FD", {MII_AN_10BASET_FD} },
++ { "100baseTx-HD", {MII_AN_100BASETX_HD} },
++ { "100baseTx-FD", {MII_AN_100BASETX_FD} },
++ { "100baseT4", {MII_AN_100BASET4} },
++ { "100baseTx", {MII_AN_100BASETX_FD | MII_AN_100BASETX_HD} },
++ { "10baseT", {MII_AN_10BASET_FD | MII_AN_10BASET_HD} },
++
++ { "1000baseT-HD", {0, MII_BMCR2_1000HALF} },
++ { "1000baseT-FD", {0, MII_BMCR2_1000FULL} },
++ { "1000baseT", {0, MII_BMCR2_1000HALF|MII_BMCR2_1000FULL} },
+ };
+ #define NMEDIA (sizeof(media)/sizeof(media[0]))
+
+ /* Parse an argument list of media types */
+-static int parse_media(char *arg)
++static int parse_media(char *arg, unsigned *bmcr2)
+ {
+ int mask, i;
+ char *s;
+ mask = strtoul(arg, &s, 16);
+ if ((*arg != '\0') && (*s == '\0')) {
+ if ((mask & MII_AN_ABILITY_MASK) &&
+- !(mask & ~MII_AN_ABILITY_MASK))
+- return mask;
++ !(mask & ~MII_AN_ABILITY_MASK)) {
++ *bmcr2 = 0;
++ return mask;
++ }
+ goto failed;
+- } else {
+- mask = 0;
+- s = strtok(arg, ", ");
+- do {
++ }
++ mask = 0;
++ *bmcr2 = 0;
++ s = strtok(arg, ", ");
++ do {
+ for (i = 0; i < NMEDIA; i++)
+- if (strcasecmp(media[i].name, s) == 0) break;
++ if (s && strcasecmp(media[i].name, s) == 0) break;
+ if (i == NMEDIA) goto failed;
+- mask |= media[i].value;
+- } while ((s = strtok(NULL, ", ")) != NULL);
+- }
++ mask |= media[i].value[0];
++ *bmcr2 |= media[i].value[1];
++ } while ((s = strtok(NULL, ", ")) != NULL);
++
+ return mask;
+ failed:
+ fprintf(stderr, "Invalid media specification '%s'.\n", arg);
+@@ -179,11 +192,24 @@
+
+ /*--------------------------------------------------------------------*/
+
+-static char *media_list(int mask, int best)
++static const char *media_list(unsigned mask, unsigned mask2, int best)
+ {
+ static char buf[100];
+ int i;
+ *buf = '\0';
++
++ if (mask & MII_BMCR_SPEED1000) {
++ if (mask2 & MII_BMCR2_1000HALF) {
++ strcat(buf, " ");
++ strcat(buf, "1000baseT-HD");
++ if (best) goto out;
++ }
++ if (mask2 & MII_BMCR2_1000FULL) {
++ strcat(buf, " ");
++ strcat(buf, "1000baseT-FD");
++ if (best) goto out;
++ }
++ }
+ mask >>= 5;
+ for (i = 4; i >= 0; i--) {
+ if (mask & (1<<i)) {
+@@ -192,6 +218,7 @@
+ if (best) break;
+ }
+ }
++ out:
+ if (mask & (1<<5))
+ strcat(buf, " flow-control");
+ return buf;
+@@ -201,15 +228,15 @@
+ {
+ char buf[100];
+ int i, mii_val[32];
+- int bmcr, bmsr, advert, lkpar;
++ unsigned bmcr, bmsr, advert, lkpar, bmcr2, lpa2;
+
+ /* Some bits in the BMSR are latched, but we can't rely on being
+ the only reader, so only the current values are meaningful */
+ mdio_read(sock, MII_BMSR);
+- for (i = 0; i < ((verbose > 1) ? 32 : 8); i++)
++ for (i = 0; i < ((verbose > 1) ? 32 : MII_BASIC_MAX); i++)
+ mii_val[i] = mdio_read(sock, i);
+
+- if (mii_val[MII_BMCR] == 0xffff) {
++ if (mii_val[MII_BMCR] == 0xffff || mii_val[MII_BMSR] == 0x0000) {
+ fprintf(stderr, " No MII transceiver present!.\n");
+ return -1;
+ }
+@@ -217,6 +244,7 @@
+ /* Descriptive rename. */
+ bmcr = mii_val[MII_BMCR]; bmsr = mii_val[MII_BMSR];
+ advert = mii_val[MII_ANAR]; lkpar = mii_val[MII_ANLPAR];
++ bmcr2 = mii_val[MII_CTRL1000]; lpa2 = mii_val[MII_STAT1000];
+
+ sprintf(buf, "%s: ", ifr.ifr_name);
+ if (bmcr & MII_BMCR_AN_ENA) {
+@@ -224,7 +252,7 @@
+ if (advert & lkpar) {
+ strcat(buf, (lkpar & MII_AN_ACK) ?
+ "negotiated" : "no autonegotiation,");
+- strcat(buf, media_list(advert & lkpar, 1));
++ strcat(buf, media_list(advert & lkpar, bmcr2 & lpa2>>2, 1));
+ strcat(buf, ", ");
+ } else {
+ strcat(buf, "autonegotiation failed, ");
+@@ -234,8 +262,10 @@
+ }
+ } else {
+ sprintf(buf+strlen(buf), "%s Mbit, %s duplex, ",
+- (bmcr & MII_BMCR_100MBIT) ? "100" : "10",
+- (bmcr & MII_BMCR_DUPLEX) ? "full" : "half");
++ ((bmcr2 & (MII_BMCR2_1000HALF | MII_BMCR2_1000FULL)) & lpa2 >> 2)
++ ? "1000"
++ : (bmcr & MII_BMCR_100MBIT) ? "100" : "10",
++ (bmcr & MII_BMCR_DUPLEX) ? "full" : "half");
+ }
+ strcat(buf, (bmsr & MII_BMSR_LINK_VALID) ? "link ok" : "no link");
+
+@@ -296,12 +326,13 @@
+ if (bmsr & MII_BMSR_REMOTE_FAULT)
+ printf("remote fault, ");
+ printf((bmsr & MII_BMSR_LINK_VALID) ? "link ok" : "no link");
+- printf("\n capabilities:%s", media_list(bmsr >> 6, 0));
+- printf("\n advertising: %s", media_list(advert, 0));
++ printf("\n capabilities:%s", media_list(bmsr >> 6, bmcr2, 0));
++ printf("\n advertising: %s", media_list(advert, lpa2 >> 2, 0));
+ if (lkpar & MII_AN_ABILITY_MASK)
+- printf("\n link partner:%s", media_list(lkpar, 0));
++ printf("\n link partner:%s", media_list(lkpar, bmcr2, 0));
+ printf("\n");
+ }
++ fflush(stdout);
+ return 0;
+ }
+
+@@ -329,7 +360,7 @@
+ printf("resetting the transceiver...\n");
+ mdio_write(skfd, MII_BMCR, MII_BMCR_RESET);
+ }
+- if (nway_advertise) {
++ if (nway_advertise > 0) {
+ mdio_write(skfd, MII_ANAR, nway_advertise | 1);
+ opt_restart = 1;
+ }
+@@ -379,27 +410,38 @@
+ /*--------------------------------------------------------------------*/
+
+ const char *usage =
+-"usage: %s [-VvRrwl] [-A media,... | -F media] [interface ...]
+- -V, --version display version information
+- -v, --verbose more verbose output
+- -R, --reset reset MII to poweron state
+- -r, --restart restart autonegotiation
+- -w, --watch monitor for link status changes
+- -l, --log with -w, write events to syslog
+- -A, --advertise=media,... advertise only specified media
+- -F, --force=media force specified media technology
+-media: 100baseT4, 100baseTx-FD, 100baseTx-HD, 10baseT-FD, 10baseT-HD,
+- (to advertise both HD and FD) 100baseTx, 10baseT\n";
++"usage: %s [-VvRrwl] [-A media,... | -F media] [interface ...]\n"
++" -V, --version display version information\n"
++" -v, --verbose more verbose output\n"
++" -R, --reset reset MII to poweron state\n"
++" -r, --restart restart autonegotiation\n"
++" -w, --watch monitor for link status changes\n"
++" -l, --log with -w, write events to syslog\n"
++" -A, --advertise=media,... advertise only specified media\n"
++" -F, --force=media force specified media technology\n"
++"media: 1000baseTx-HD, 1000baseTx-FD,\n"
++" 100baseT4, 100baseTx-FD, 100baseTx-HD,\n"
++" 10baseT-FD, 10baseT-HD,\n"
++" (to advertise both HD and FD) 1000baseTx, 100baseTx, 10baseT\n";
++
++
++static void version(void)
++{
++ fprintf(stderr, "%s\n%s\n", Version, RELEASE);
++ exit(5); /* E_VERSION */
++}
++
+
+ int main(int argc, char **argv)
+ {
+ int i, c, ret, errflag = 0;
+ char s[6];
++ unsigned ctrl1000 = 0;
+
+ while ((c = getopt_long(argc, argv, "A:F:p:lrRvVw?", longopts, 0)) != EOF)
+ switch (c) {
+- case 'A': nway_advertise = parse_media(optarg); break;
+- case 'F': fixed_speed = parse_media(optarg); break;
++ case 'A': nway_advertise = parse_media(optarg, &ctrl1000); break;
++ case 'F': fixed_speed = parse_media(optarg, &ctrl1000); break;
+ case 'p': override_phy = atoi(optarg); break;
+ case 'r': opt_restart++; break;
+ case 'R': opt_reset++; break;
+@@ -411,6 +453,10 @@
+ }
+ /* Check for a few inappropriate option combinations */
+ if (opt_watch) verbose = 0;
++
++ if ((nway_advertise < 0) || (fixed_speed < 0))
++ return 2;
++
+ if (errflag || (fixed_speed & (fixed_speed-1)) ||
+ (fixed_speed && (opt_restart || nway_advertise))) {
+ fprintf(stderr, usage, argv[0]);
+@@ -418,7 +464,7 @@
+ }
+
+ if (opt_version)
+- printf(version);
++ version();
+
+ /* Open a basic socket. */
+ if ((skfd = socket(AF_INET, SOCK_DGRAM,0)) < 0) {
+@@ -426,6 +472,9 @@
+ exit(-1);
+ }
+
++ if (verbose > 1)
++ printf("Using SIOCGMIIPHY=0x%x\n", SIOCGMIIPHY);
++
+ /* No remaining args means show all interfaces. */
+ if (optind == argc) {
+ ret = 1;
--- net-tools-1.60/nameif.c 2000-10-18 19:26:29.000000000 +0200
+++ net-tools/nameif.c 2003-09-11 06:46:49.000000000 +0300
@@ -3,7 +3,7 @@
@@ -8259,161 +8740,3 @@
return;
}
type = ent->type;
---- net-tools-1.60/lib/eui64.c 1970-01-01 03:00:00.000000000 +0300
-+++ net-tools/lib/eui64.c 2001-11-12 04:12:05.000000000 +0200
-@@ -0,0 +1,155 @@
-+/*
-+ * lib/eui64.c This file contains support for generic EUI-64 hw addressing
-+ *
-+ * Version: $Id$
-+ *
-+ * Author: Daniel Stodden <stodden at in.tum.de>
-+ * Copyright 2001 Daniel Stodden
-+ *
-+ * blueprinted from ether.c
-+ * Copyright 1993 MicroWalt Corporation
-+ *
-+ * This program is free software; you can redistribute it
-+ * and/or modify it under the terms of the GNU General
-+ * Public License as published by the Free Software
-+ * Foundation; either version 2 of the License, or (at
-+ * your option) any later version.
-+ */
-+#include "config.h"
-+
-+#if HAVE_HWEUI64
-+
-+#include <sys/types.h>
-+#include <sys/ioctl.h>
-+#include <sys/socket.h>
-+#include <net/if_arp.h>
-+#include <stdlib.h>
-+#include <stdio.h>
-+#include <ctype.h>
-+#include <errno.h>
-+#include <fcntl.h>
-+#include <string.h>
-+#include <termios.h>
-+#include <unistd.h>
-+#include "net-support.h"
-+#include "pathnames.h"
-+#include "intl.h"
-+
-+/*
-+ * EUI-64 constants
-+ */
-+
-+#define EUI64_ALEN 8
-+
-+#ifndef ARPHRD_EUI64
-+#define ARPHRD_EUI64 27
-+#warning "ARPHRD_EUI64 not defined in <net/if_arp.h>. Using private value 27"
-+#endif
-+
-+struct hwtype eui64_hwtype;
-+
-+/* Display an EUI-64 address in readable format. */
-+static char *pr_eui64( unsigned char *ptr )
-+{
-+ static char buff[64];
-+
-+ snprintf(buff, sizeof(buff), "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",
-+ (ptr[0] & 0377), (ptr[1] & 0377), (ptr[2] & 0377), (ptr[3] & 0377),
-+ (ptr[4] & 0377), (ptr[5] & 0377), (ptr[6] & 0377), (ptr[7] & 0377)
-+ );
-+ return (buff);
-+}
-+
-+/* Start the PPP encapsulation on the file descriptor. */
-+static int in_eui64( char *bufp, struct sockaddr *sap )
-+{
-+ unsigned char *ptr;
<<Diff was trimmed, longer than 597 lines>>
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/net-tools-branch.diff?r1=1.2&r2=1.3&f=u
More information about the pld-cvs-commit
mailing list