Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Nov 2003 23:09:55 -0800 (PST)
From:      Brooks Davis <brooks@one-eyed-alien.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/59452: [PATCH] make x11-wm/epplets work with if_xname
Message-ID:  <200311190709.hAJ79taI077044@freefall.freebsd.org>
Resent-Message-ID: <200311190720.hAJ7KBEh077253@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         59452
>Category:       ports
>Synopsis:       [PATCH] make x11-wm/epplets work with if_xname
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 18 23:20:11 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Brooks Davis
>Release:        FreeBSD 4.9-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD freefall.freebsd.org 4.9-PRERELEASE FreeBSD 4.9-PRERELEASE #9: Tue Sep 16 16:58:42 PDT 2003 peter@freefall.freebsd.org:/c/src/sys/compile/FREEFALL i386


	
>Description:

	Make epplets compile with if_xname.

>How-To-Repeat:
	
>Fix:

Index: files/patch-an
===================================================================
RCS file: /usr/cvs/ports/x11-wm/epplets/files/patch-an,v
retrieving revision 1.1
diff -u -p -r1.1 patch-an
--- files/patch-an	11 Aug 2001 20:18:19 -0000	1.1
+++ files/patch-an	19 Nov 2003 06:58:01 -0000
@@ -1,6 +1,9 @@
---- epplets/net.c.orig	Tue Jul 31 23:50:29 2001
-+++ epplets/net.c	Fri Aug 10 14:54:32 2001
-@@ -35,6 +35,22 @@
+
+$FreeBSD$
+
+--- epplets/net.c.orig	Wed Dec 22 02:52:54 1999
++++ epplets/net.c	Tue Nov 18 22:57:45 2003
+@@ -35,6 +35,23 @@
  # include <kstat.h>
  # include <sys/sysinfo.h>
  #endif
@@ -9,6 +12,7 @@
 +
 +#include <sys/types.h>
 +#include <sys/socket.h>
++#include <sys/param.h>
 +
 +#include <net/if.h>
 +#include <net/if_var.h>
@@ -23,7 +27,7 @@
  #include "epplet.h"
  #include "net.h"
  
-@@ -51,6 +67,18 @@
+@@ -51,6 +68,18 @@
    char buff[256], **names = NULL, *s;
    unsigned long i;
  
@@ -42,7 +46,7 @@
    names = (char **) malloc(sizeof(char *));
    memset(names, 0, sizeof(char *));
  
-@@ -80,6 +108,66 @@
+@@ -80,6 +109,70 @@
    return (names);
  #elif defined(__sun__)
    return ((char **) NULL);
@@ -80,6 +84,7 @@
 +	num = 0;
 +	while(ifnetaddr)
 +	{
++#if __FreeBSD_version < 501113
 +		if(kvm_read(kd, ifnetaddr, &ifnet, sizeof(ifnet)) == -1 ||  
 +			kvm_read(kd, (long)ifnet.if_name, type, 16) == -1)
 +		{
@@ -90,6 +95,9 @@
 +		ifnetaddr = (unsigned long)TAILQ_NEXT(&ifnet, if_link);
 +		
 +		snprintf(name, 32, "%s%d", type, ifnet.if_unit);
++#else
++		strlcpy(name, ifnet.if_xname, sizeof(name));
++#endif
 +
 +		if((names = (char **)realloc(names, (++num + 1)*sizeof(char *))) == NULL)
 +			return NULL;
@@ -109,7 +117,7 @@
  #else
    return ((char **) NULL);
  #endif
-@@ -97,6 +185,21 @@
+@@ -97,6 +190,21 @@
    unsigned char match = 0;
    FILE *fp;
    char buff[256], *colon = NULL, dev[64], in_str[64], out_str[64];
@@ -131,7 +139,7 @@
  #endif
  
    if (device == NULL) {
-@@ -151,6 +254,104 @@
+@@ -151,6 +259,108 @@
    }
    fclose(fp);
    return ((match) ? (0) : (ENODEV));
@@ -172,6 +180,7 @@
 +		if(ifaddraddr == 0)
 +		{
 +			ifnetfound = ifnetaddr;
++#if __FreeBSD_version < 501113
 +			if(kvm_read(kd, ifnetaddr, &ifnet, sizeof(ifnet)) == -1 ||  
 +				kvm_read(kd, (long)ifnet.if_name, tname, 16) == -1)
 +			{
@@ -181,8 +190,11 @@
 +			}
 +	
 +			tname[15] = '\0';
-+			ifnetaddr = (unsigned long)TAILQ_NEXT(&ifnet, if_link);
 +			snprintf(name, 32, "%s%d", tname, ifnet.if_unit);
++#else
++			strlcpy(name, ifnet.if_xname, sizeof(name));
++#endif
++			ifnetaddr = (unsigned long)TAILQ_NEXT(&ifnet, if_link);
 +
 +			if(strncasecmp(name, device, 16) != 0)
 +				continue;
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200311190709.hAJ79taI077044>