summaryrefslogtreecommitdiff
path: root/sysutils/system-tools-backends/files/patch-network.pl.in
blob: 9820ac4113e3f4ce961ad6d31e358ef3514bce6b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
--- network.pl.in.orig	Thu Jul  6 16:43:53 2006
+++ network.pl.in	Thu Jul  6 16:48:47 2006
@@ -94,7 +94,7 @@
   my ($fd, $line, $iface);
   my (@ifaces, $command);
 
-  $command = &gst_file_get_cmd_path ("iwconfig");
+  $command = &gst_file_get_cmd_path ("ifconfig");
   open $fd, "$command |";
   return @ifaces if $fd eq undef;
 
@@ -117,6 +117,38 @@
   return \@ifaces;
 }
 
+sub gst_network_get_freebsd_ethernet_ifaces
+{
+  my ($fd, $line, $iface);
+  my (@ifaces, $command);
+
+  $command = &gst_file_get_cmd_path ("ifconfig");
+  open $fd, "$command |";
+  return @ifaces if $fd eq undef;
+
+  while (<$fd>)
+  {
+    if (/^([a-zA-Z]+[0-9]+):/)
+    {
+      $iface = $1;
+    }
+
+    if (/media:.*ethernet.*/i)
+    {
+      push @ifaces, $iface;
+    }
+    elsif (/ether:*/i)
+    {
+      push @ifaces, $iface;
+    }
+  }
+
+  &gst_file_close ($fd);
+  &gst_report_leave ();
+
+  return \@ifaces;
+}
+
 # Returns an array with the wireless devices found
 sub gst_network_get_wireless_ifaces
 {
@@ -126,6 +158,13 @@
   return &gst_network_get_freebsd_wireless_ifaces if ($plat eq "FreeBSD");
 }
 
+sub gst_network_get_ethernet_ifaces
+{
+  my ($plat) = $$tool{"system"};
+
+  return &gst_network_get_freebsd_ethernet_ifaces if ($plat eq "FreeBSD");
+}
+
 # set of functions for enabling an interface
 sub gst_network_config_wireless
 {
@@ -778,9 +817,21 @@
 {
   my ($dev) = @_;
   my (@wireless_ifaces, $wi, $type);
+  my (@ethernet_ifaces, $eth, $type);
 
   return $types_cache{$dev} if (exists $types_cache{$dev});
 
+  #check whether interface is ethernet
+  $ethernet_ifaces = &gst_network_get_ethernet_ifaces ();
+  foreach $eth (@$ethernet_ifaces)
+  {
+    if ($dev eq $eth)
+    {
+      $types_cache{$dev} = "ethernet";
+      return $types_cache{$dev};
+    }
+  }
+
   #check whether interface is wireless
   $wireless_ifaces = &gst_network_get_wireless_ifaces ();
   foreach $wi (@$wireless_ifaces)
@@ -803,10 +854,6 @@
     {
       $types_cache{$dev} = "modem";
     }
-  }
-  elsif ($dev =~ /^(eth|dc|ed|bfe|em|fxp|bge|de|xl|ixgb|txp|vx|lge|nge|pcn|re|rl|sf|sis|sk|ste|ti|tl|tx|vge|vr|wb|cs|ex|ep|fe|ie|lnc|sn|xe|le|an|awi|wi|ndis|wlaue|axe|cue|kue|rue|fwe|nve)[0-9]/)
-  {
-    $types_cache{$dev} = "ethernet";
   }
   elsif ($dev =~ /^irlan[0-9]/)
   {