forked from Lainports/freebsd-ports
97 lines
2.2 KiB
Perl
97 lines
2.2 KiB
Perl
--- 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]/)
|
|
{
|