View | Details | Raw Unified | Return to bug 59452
Collapse All | Expand All

(-)files/patch-an (-8 / +20 lines)
Lines 1-6 Link Here
1
--- epplets/net.c.orig	Tue Jul 31 23:50:29 2001
1
2
+++ epplets/net.c	Fri Aug 10 14:54:32 2001
2
$FreeBSD$
3
@@ -35,6 +35,22 @@
3
4
--- epplets/net.c.orig	Wed Dec 22 02:52:54 1999
5
+++ epplets/net.c	Tue Nov 18 22:57:45 2003
6
@@ -35,6 +35,23 @@
4
 # include <kstat.h>
7
 # include <kstat.h>
5
 # include <sys/sysinfo.h>
8
 # include <sys/sysinfo.h>
6
 #endif
9
 #endif
Lines 9-14 Link Here
9
+
12
+
10
+#include <sys/types.h>
13
+#include <sys/types.h>
11
+#include <sys/socket.h>
14
+#include <sys/socket.h>
15
+#include <sys/param.h>
12
+
16
+
13
+#include <net/if.h>
17
+#include <net/if.h>
14
+#include <net/if_var.h>
18
+#include <net/if_var.h>
Lines 23-29 Link Here
23
 #include "epplet.h"
27
 #include "epplet.h"
24
 #include "net.h"
28
 #include "net.h"
25
 
29
 
26
@@ -51,6 +67,18 @@
30
@@ -51,6 +68,18 @@
27
   char buff[256], **names = NULL, *s;
31
   char buff[256], **names = NULL, *s;
28
   unsigned long i;
32
   unsigned long i;
29
 
33
 
Lines 42-48 Link Here
42
   names = (char **) malloc(sizeof(char *));
46
   names = (char **) malloc(sizeof(char *));
43
   memset(names, 0, sizeof(char *));
47
   memset(names, 0, sizeof(char *));
44
 
48
 
45
@@ -80,6 +108,66 @@
49
@@ -80,6 +109,70 @@
46
   return (names);
50
   return (names);
47
 #elif defined(__sun__)
51
 #elif defined(__sun__)
48
   return ((char **) NULL);
52
   return ((char **) NULL);
Lines 80-85 Link Here
80
+	num = 0;
84
+	num = 0;
81
+	while(ifnetaddr)
85
+	while(ifnetaddr)
82
+	{
86
+	{
87
+#if __FreeBSD_version < 501113
83
+		if(kvm_read(kd, ifnetaddr, &ifnet, sizeof(ifnet)) == -1 ||  
88
+		if(kvm_read(kd, ifnetaddr, &ifnet, sizeof(ifnet)) == -1 ||  
84
+			kvm_read(kd, (long)ifnet.if_name, type, 16) == -1)
89
+			kvm_read(kd, (long)ifnet.if_name, type, 16) == -1)
85
+		{
90
+		{
Lines 90-95 Link Here
90
+		ifnetaddr = (unsigned long)TAILQ_NEXT(&ifnet, if_link);
95
+		ifnetaddr = (unsigned long)TAILQ_NEXT(&ifnet, if_link);
91
+		
96
+		
92
+		snprintf(name, 32, "%s%d", type, ifnet.if_unit);
97
+		snprintf(name, 32, "%s%d", type, ifnet.if_unit);
98
+#else
99
+		strlcpy(name, ifnet.if_xname, sizeof(name));
100
+#endif
93
+
101
+
94
+		if((names = (char **)realloc(names, (++num + 1)*sizeof(char *))) == NULL)
102
+		if((names = (char **)realloc(names, (++num + 1)*sizeof(char *))) == NULL)
95
+			return NULL;
103
+			return NULL;
Lines 109-115 Link Here
109
 #else
117
 #else
110
   return ((char **) NULL);
118
   return ((char **) NULL);
111
 #endif
119
 #endif
112
@@ -97,6 +185,21 @@
120
@@ -97,6 +190,21 @@
113
   unsigned char match = 0;
121
   unsigned char match = 0;
114
   FILE *fp;
122
   FILE *fp;
115
   char buff[256], *colon = NULL, dev[64], in_str[64], out_str[64];
123
   char buff[256], *colon = NULL, dev[64], in_str[64], out_str[64];
Lines 131-137 Link Here
131
 #endif
139
 #endif
132
 
140
 
133
   if (device == NULL) {
141
   if (device == NULL) {
134
@@ -151,6 +254,104 @@
142
@@ -151,6 +259,108 @@
135
   }
143
   }
136
   fclose(fp);
144
   fclose(fp);
137
   return ((match) ? (0) : (ENODEV));
145
   return ((match) ? (0) : (ENODEV));
Lines 172-177 Link Here
172
+		if(ifaddraddr == 0)
180
+		if(ifaddraddr == 0)
173
+		{
181
+		{
174
+			ifnetfound = ifnetaddr;
182
+			ifnetfound = ifnetaddr;
183
+#if __FreeBSD_version < 501113
175
+			if(kvm_read(kd, ifnetaddr, &ifnet, sizeof(ifnet)) == -1 ||  
184
+			if(kvm_read(kd, ifnetaddr, &ifnet, sizeof(ifnet)) == -1 ||  
176
+				kvm_read(kd, (long)ifnet.if_name, tname, 16) == -1)
185
+				kvm_read(kd, (long)ifnet.if_name, tname, 16) == -1)
177
+			{
186
+			{
Lines 181-188 Link Here
181
+			}
190
+			}
182
+	
191
+	
183
+			tname[15] = '\0';
192
+			tname[15] = '\0';
184
+			ifnetaddr = (unsigned long)TAILQ_NEXT(&ifnet, if_link);
185
+			snprintf(name, 32, "%s%d", tname, ifnet.if_unit);
193
+			snprintf(name, 32, "%s%d", tname, ifnet.if_unit);
194
+#else
195
+			strlcpy(name, ifnet.if_xname, sizeof(name));
196
+#endif
197
+			ifnetaddr = (unsigned long)TAILQ_NEXT(&ifnet, if_link);
186
+
198
+
187
+			if(strncasecmp(name, device, 16) != 0)
199
+			if(strncasecmp(name, device, 16) != 0)
188
+				continue;
200
+				continue;

Return to bug 59452