YaST Commits
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
July 2007
- 26 participants
- 747 discussions
[yast-commit] r39118 - in /trunk/network: VERSION package/yast2-network.changes src/lan/complex.ycp src/modules/LanItems.ycp
by mzugec@svn.opensuse.org 02 Jul '07
by mzugec@svn.opensuse.org 02 Jul '07
02 Jul '07
Author: mzugec
Date: Mon Jul 2 17:48:23 2007
New Revision: 39118
URL: http://svn.opensuse.org/viewcvs/yast?rev=39118&view=rev
Log:
fixed delete item
Modified:
trunk/network/VERSION
trunk/network/package/yast2-network.changes
trunk/network/src/lan/complex.ycp
trunk/network/src/modules/LanItems.ycp
Modified: trunk/network/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/VERSION?rev=39118&r1=391…
==============================================================================
--- trunk/network/VERSION (original)
+++ trunk/network/VERSION Mon Jul 2 17:48:23 2007
@@ -1 +1 @@
-2.15.46
+2.15.47
Modified: trunk/network/package/yast2-network.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/package/yast2-network.ch…
==============================================================================
--- trunk/network/package/yast2-network.changes (original)
+++ trunk/network/package/yast2-network.changes Mon Jul 2 17:48:23 2007
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Mon Jul 2 17:47:46 CEST 2007 - mzugec(a)suse.cz
+
+- fixed delete item
+- 2.15.47
+
+-------------------------------------------------------------------
Mon Jul 2 16:53:26 CEST 2007 - mzugec(a)suse.cz
- new module LanItems.ycp
Modified: trunk/network/src/lan/complex.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/lan/complex.ycp?rev=…
==============================================================================
--- trunk/network/src/lan/complex.ycp (original)
+++ trunk/network/src/lan/complex.ycp Mon Jul 2 17:48:23 2007
@@ -216,11 +216,9 @@
NetworkService::SetManaged (value);
}
-//list<map<string,any> > o_items = nil;
void initOverview (string key) ``{
-// o_items = (list<map<string,any> >)LanItems::Overview();
-
+y2internal("init");
list<term> term_items = maplist (map<string,any> i, (list<map<string,any> >)LanItems::Overview(), {
term t = `item (`id (i["id"]:-1));
@@ -240,8 +238,13 @@
}
LanItems::current = (integer)UI::QueryWidget (`id (`_hw_items), `CurrentItem);
UI::ChangeWidget(`_hw_sum, `Value,LanItems::GetItemDescription());
+ if (!LanItems::IsItemConfigured()) // unconfigured
+ UI::ChangeWidget(`id(`delete), `Enabled, false);
+ else UI::ChangeWidget(`id(`delete), `Enabled, true);
}
+
+
symbol handleOverview( string key, map event ) {
LanItems::current = (integer)UI::QueryWidget (`id (`_hw_items), `CurrentItem);
Modified: trunk/network/src/modules/LanItems.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/modules/LanItems.ycp…
==============================================================================
--- trunk/network/src/modules/LanItems.ycp (original)
+++ trunk/network/src/modules/LanItems.ycp Mon Jul 2 17:48:23 2007
@@ -1128,6 +1128,17 @@
NetworkModules::DeleteM(hwcfg);
Items[current, "hwcfg"] = "";
}
+ if (! (size(Items[current, "hwinfo"]:$[])>0) ){
+ map<integer, any> tmp_items = $[];
+ foreach(integer key, any value, Items, {
+ if (key==current) continue;
+ else{
+ if (key<current) tmp_items[key]=Items[key]:$[];
+ else tmp_items[key-1]=Items[key]:$[];
+ }
+ });
+ Items = tmp_items;
+ }
SetModified();
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r39117 - /trunk/storage/package/yast2-storage.changes
by fehr@svn.opensuse.org 02 Jul '07
by fehr@svn.opensuse.org 02 Jul '07
02 Jul '07
Author: fehr
Date: Mon Jul 2 17:39:50 2007
New Revision: 39117
URL: http://svn.opensuse.org/viewcvs/yast?rev=39117&view=rev
Log:
fix typo
Modified:
trunk/storage/package/yast2-storage.changes
Modified: trunk/storage/package/yast2-storage.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.ch…
==============================================================================
--- trunk/storage/package/yast2-storage.changes (original)
+++ trunk/storage/package/yast2-storage.changes Mon Jul 2 17:39:50 2007
@@ -15,7 +15,7 @@
-------------------------------------------------------------------
Mon Jun 18 12:48:04 CEST 2007 - fehr(a)suse.de
-- add menu extry to call iSCSI client setup (#278554)
+- add menu entry to call iSCSI client setup (#278554)
- version 2.15.16
-------------------------------------------------------------------
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r39116 - /branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc
by sh-sh-sh@svn.opensuse.org 02 Jul '07
by sh-sh-sh@svn.opensuse.org 02 Jul '07
02 Jul '07
Author: sh-sh-sh
Date: Mon Jul 2 17:25:33 2007
New Revision: 39116
URL: http://svn.opensuse.org/viewcvs/yast?rev=39116&view=rev
Log:
fixed symbol property handling
Modified:
branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc Mon Jul 2 17:25:33 2007
@@ -894,7 +894,8 @@
if ( newValue->isString() ) val = YPropertyValue( newValue->asString()->value() );
else if ( newValue->isInteger() ) val = YPropertyValue( newValue->asInteger()->value() );
else if ( newValue->isBoolean() ) val = YPropertyValue( newValue->asBoolean()->value() );
- else if ( newValue->isVoid() ) YCPPropertyHandler::setComplexProperty( widget, propertyName, newValue );
+ else if ( newValue->isVoid() ||
+ newValue->isSymbol() ) YCPPropertyHandler::setComplexProperty( widget, propertyName, newValue );
else
{
y2error( "Unknown type for property %s::%s: %s",
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r39115 - /branches/tmp/sh/mod-ui/qt/src/YQSelectionBox.cc
by sh-sh-sh@svn.opensuse.org 02 Jul '07
by sh-sh-sh@svn.opensuse.org 02 Jul '07
02 Jul '07
Author: sh-sh-sh
Date: Mon Jul 2 17:21:08 2007
New Revision: 39115
URL: http://svn.opensuse.org/viewcvs/yast?rev=39115&view=rev
Log:
fixed selection
Modified:
branches/tmp/sh/mod-ui/qt/src/YQSelectionBox.cc
Modified: branches/tmp/sh/mod-ui/qt/src/YQSelectionBox.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQSelect…
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQSelectionBox.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQSelectionBox.cc Mon Jul 2 17:21:08 2007
@@ -33,6 +33,7 @@
#include "YQDialog.h"
#include "YUIException.h"
+#define VERBOSE_SELECTION 1
#define DEFAULT_VISIBLE_LINES 5
#define SHRINKABLE_VISIBLE_LINES 2
@@ -63,14 +64,14 @@
_qt_listBox->setTopItem(0);
_qt_label->setBuddy( _qt_listBox );
- if ( notify() )
- {
- connect( _qt_listBox, SIGNAL( highlighted ( int ) ),
- this, SLOT ( slotSelected( int ) ) );
+ connect( _qt_listBox, SIGNAL( highlighted ( int ) ),
+ this, SLOT ( slotSelected( int ) ) );
- connect( _qt_listBox, SIGNAL( doubleClicked( QListBoxItem * ) ),
- this, SLOT ( slotActivated( QListBoxItem * ) ) );
+ connect( _qt_listBox, SIGNAL( doubleClicked( QListBoxItem * ) ),
+ this, SLOT ( slotActivated( QListBoxItem * ) ) );
+ if ( notify() )
+ {
connect( &_timer, SIGNAL( timeout() ),
this, SLOT ( returnImmediately() ) );
}
@@ -160,7 +161,16 @@
YItem * item = YSelectionWidget::itemAt( index );
if ( item )
+ {
+#ifdef VERBOSE_SELECTION
+ y2debug( "%s \"%s\": Selecting item \"%s\"",
+ widgetClass(),
+ debugLabel().c_str(),
+ item->label().c_str() );
+#endif
+
item->setSelected( true );
+ }
else
YUI_THROW( YUIException( "Can't find selected item" ) );
}
@@ -275,24 +285,27 @@
{
selectItem( index );
- if ( immediateMode() )
- returnImmediately();
- else
+ if ( notify() )
{
- if ( ! YQUI::ui()->eventsBlocked() )
+ if ( immediateMode() )
+ returnImmediately();
+ else
{
- // Delayed event delivery - only if events are to be delivered
- // right now.
- //
- // An event block that is in effect right now may or may not affect
- // events after the timer delay is expired.
- //
- // This may create nasty side effects such as bug #32510: When an
- // item is initially selected, that initial selection event gets
- // through even though (!) events are blocked during widget
- // creation.
+ if ( ! YQUI::ui()->eventsBlocked() )
+ {
+ // Delayed event delivery - only if events are to be delivered
+ // right now.
+ //
+ // An event block that is in effect right now may or may not affect
+ // events after the timer delay is expired.
+ //
+ // This may create nasty side effects such as bug #32510: When an
+ // item is initially selected, that initial selection event gets
+ // through even though (!) events are blocked during widget
+ // creation.
- returnDelayed();
+ returnDelayed();
+ }
}
}
}
@@ -300,24 +313,10 @@
void YQSelectionBox::slotActivated( QListBoxItem * qItem )
{
- YItem * item = itemAt( _qt_listBox->index( qItem ) );
+ selectItem( _qt_listBox->index( qItem ) );
- if ( item )
- {
-#if 1
- y2debug( "Item %s selected", item->label().c_str() );
-#endif
- YSelectionBox::deselectAllItems();
- item->setSelected( true );
-
+ if ( notify() )
YQUI::ui()->sendEvent( new YWidgetEvent( this, YEvent::Activated ) );
- }
- else
- {
- y2error( "%s: No YItem %s found",
- debugLabel().c_str(),
- toUTF8( qItem->text() ).c_str() );
- }
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r39114 - /branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.cc
by sh-sh-sh@svn.opensuse.org 02 Jul '07
by sh-sh-sh@svn.opensuse.org 02 Jul '07
02 Jul '07
Author: sh-sh-sh
Date: Mon Jul 2 17:20:53 2007
New Revision: 39114
URL: http://svn.opensuse.org/viewcvs/yast?rev=39114&view=rev
Log:
enforce initial selection
Modified:
branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.cc
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.cc Mon Jul 2 17:20:53 2007
@@ -155,26 +155,38 @@
// Enforce single selection (if applicable)
//
- if ( priv->enforceSingleSelection && item->selected() )
+ if ( priv->enforceSingleSelection )
{
- YItem * oldSelectedItem = selectedItem();
-
- // This looks expensive, but it is not: Even though selectedItem()
- // searches the complete item list until it finds a selected item, this
- // happens only if a new item is to be inserted that has the "selected"
- // flag on. In the normal case, this will only be one item.
- //
- // Only if the calling application does this systematically wrong and
- // sets the "selected" flag for ALL items it inserts this will be more
- // expensive. But then, this is a bug in that application that needs to
- // be fixed.
-
- if ( oldSelectedItem && oldSelectedItem != item )
+ if ( item->selected() )
{
- oldSelectedItem->setSelected( false );
- y2warning( "Enforcing single selection: Deselecting %s",
- oldSelectedItem->label().c_str() );
+ YItem * oldSelectedItem = selectedItem();
+
+ // This looks expensive, but it is not: Even though selectedItem()
+ // searches the complete item list until it finds a selected item, this
+ // happens only if a new item is to be inserted that has the "selected"
+ // flag on. In the normal case, this will only be one item.
+ //
+ // Only if the calling application does this systematically wrong and
+ // sets the "selected" flag for ALL items it inserts this will be more
+ // expensive. But then, this is a bug in that application that needs to
+ // be fixed.
+
+
+
+ if ( oldSelectedItem && oldSelectedItem != item )
+ {
+ oldSelectedItem->setSelected( false );
+ }
}
+
+
+ // Make sure there is one item selected initially.
+ //
+ // If any other subsequently added items are to be selected, they will
+ // override this initial selection.
+
+ if ( priv->itemCollection.size() == 1 )
+ item->setSelected( true );
}
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
02 Jul '07
Author: mzugec
Date: Mon Jul 2 16:54:02 2007
New Revision: 39113
URL: http://svn.opensuse.org/viewcvs/yast?rev=39113&view=rev
Log:
Created tag stable-2_15_46 for network
Added:
tags/stable-2_15_46/network/
- copied from r39112, trunk/network/
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
Author: mzugec
Date: Mon Jul 2 16:54:00 2007
New Revision: 39112
URL: http://svn.opensuse.org/viewcvs/yast?rev=39112&view=rev
Log:
Created tag stable-2_15_46
Added:
tags/stable-2_15_46/
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r39111 - in /trunk/network: ./ agents/ package/ src/clients/ src/dsl/ src/lan/ src/modules/ src/routines/
by mzugec@svn.opensuse.org 02 Jul '07
by mzugec@svn.opensuse.org 02 Jul '07
02 Jul '07
Author: mzugec
Date: Mon Jul 2 16:53:49 2007
New Revision: 39111
URL: http://svn.opensuse.org/viewcvs/yast?rev=39111&view=rev
Log:
- new module LanItems.ycp
http://lists.opensuse.org/yast-devel/2007-06/msg00001.html
- new udev agent
- propose configuration based on interface name (ifcfg-eth0)
- use getcfg for matching hwcfg instead of nm_name
- use sysfs_id to match configuration instead of udi/unique
- 2.15.46
Added:
trunk/network/agents/ag_udev_persistent (with props)
trunk/network/agents/cfg_udev_persistent.scr
trunk/network/src/modules/LanItems.ycp
Modified:
trunk/network/VERSION
trunk/network/agents/Makefile.am
trunk/network/package/yast2-network.changes
trunk/network/src/clients/general_proposal.ycp
trunk/network/src/clients/lan_auto.ycp
trunk/network/src/clients/lan_proposal.ycp
trunk/network/src/clients/save_network.ycp
trunk/network/src/dsl/dialogs.ycp
trunk/network/src/lan/address.ycp
trunk/network/src/lan/cmdline.ycp
trunk/network/src/lan/complex.ycp
trunk/network/src/lan/hardware.ycp
trunk/network/src/lan/virtual.ycp
trunk/network/src/lan/wireless.ycp
trunk/network/src/lan/wizards.ycp
trunk/network/src/modules/Lan.ycp
trunk/network/src/routines/complex.ycp
trunk/network/src/routines/hardware.ycp
trunk/network/src/routines/routines.ycp
Modified: trunk/network/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/VERSION?rev=39111&r1=391…
==============================================================================
--- trunk/network/VERSION (original)
+++ trunk/network/VERSION Mon Jul 2 16:53:49 2007
@@ -1 +1 @@
-2.15.45
+2.15.46
Modified: trunk/network/agents/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/agents/Makefile.am?rev=3…
==============================================================================
--- trunk/network/agents/Makefile.am (original)
+++ trunk/network/agents/Makefile.am Mon Jul 2 16:53:49 2007
@@ -4,5 +4,6 @@
# $Id$
#
+agent_SCRIPTS = ag_udev_persistent
scrconf_DATA = $(wildcard *.scr)
-EXTRA_DIST = $(scrconf_DATA)
+EXTRA_DIST = $(agent_SCRIPTS) $(scrconf_DATA)
Added: trunk/network/agents/ag_udev_persistent
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/agents/ag_udev_persisten…
==============================================================================
--- trunk/network/agents/ag_udev_persistent (added)
+++ trunk/network/agents/ag_udev_persistent Mon Jul 2 16:53:49 2007
@@ -0,0 +1,69 @@
+#!/usr/bin/perl -w
+package ag_udev_persistent;
+BEGIN { push( @INC, '/usr/share/YaST2/modules/' ); }
+use ycp;
+use YaST::SCRAgent;
+use YaPI;
+textdomain "network";
+our @ISA = ("YaST::SCRAgent");
+
+use strict;
+
+my $filename = "/etc/udev/rules.d/70-net_persistent_names.rules";
+my @comment = ();
+
+sub parse_rules {
+ my $class = shift;
+ my %hash_table = ();
+ # you don't need it read twice
+ return 1 if (keys(%hash_table));
+
+ if( open( FILE, "< $filename" ) ) {
+ while( my $line = <FILE> ) {
+
+ # remove '\n' and speace before delimiter ','
+ chomp($line);
+ $line =~ s/, /,/g;
+
+ if ( $line =~ /^#/ ) { push(@comment, $line); }
+ else {
+ my @cols = split(",", $line);
+ my (undef, undef, $device) = split(" ", $cols[3]);
+ $device =~ s/\"//g;
+ $hash_table{ $device } = \@cols;
+ }
+ }
+ close(FILE);
+ } else {
+ return $class->SetError(summary => sprintf( _("opening %s failed: %s"),$filename, $!),
+ code => "OPEN_FAILED");
+ }
+
+ return \%hash_table;
+}
+
+sub Execute {
+ my $class = shift;
+ my ($path, @args) = @_;
+
+ return 1;
+}
+
+
+sub Read {
+ my $class = shift;
+ my ($path, @args) = @_;
+
+ return $class->parse_rules();
+}
+
+sub Write {
+}
+
+sub Dir {
+}
+
+package main;
+
+ag_udev_persistent->Run ();
+
Added: trunk/network/agents/cfg_udev_persistent.scr
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/agents/cfg_udev_persiste…
==============================================================================
--- trunk/network/agents/cfg_udev_persistent.scr (added)
+++ trunk/network/agents/cfg_udev_persistent.scr Mon Jul 2 16:53:49 2007
@@ -0,0 +1,19 @@
+/**
+ * File:
+ * tty.scr
+ * Summary:
+ * SCR Agent for reading/writing Apache2 configuration
+ * Access:
+ * read/write
+ * Authors:
+ * See:
+ * anyagent
+ * libscr
+ * Example:
+
+ * $Id: cfg_http_server.scr 14516 2004-02-20 16:34:50Z visnov $
+ *
+ */
+.udev_persistent
+
+`ag_udev_persistent ()
Modified: trunk/network/package/yast2-network.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/package/yast2-network.ch…
==============================================================================
--- trunk/network/package/yast2-network.changes (original)
+++ trunk/network/package/yast2-network.changes Mon Jul 2 16:53:49 2007
@@ -1,4 +1,15 @@
-------------------------------------------------------------------
+Mon Jul 2 16:53:26 CEST 2007 - mzugec(a)suse.cz
+
+- new module LanItems.ycp
+http://lists.opensuse.org/yast-devel/2007-06/msg00001.html
+- new udev agent
+- propose configuration based on interface name (ifcfg-eth0)
+- use getcfg for matching hwcfg instead of nm_name
+- use sysfs_id to match configuration instead of udi/unique
+- 2.15.46
+
+-------------------------------------------------------------------
Thu Jun 21 17:39:03 CEST 2007 - adrian(a)suse.de
- fix changelog entry order
Modified: trunk/network/src/clients/general_proposal.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/clients/general_prop…
==============================================================================
--- trunk/network/src/clients/general_proposal.ycp (original)
+++ trunk/network/src/clients/general_proposal.ycp Mon Jul 2 16:53:49 2007
@@ -20,6 +20,7 @@
y2milestone("Arguments: %1", WFM::Args());
import "Lan";
+import "LanItems";
import "NetworkService";
include "network/lan/complex.ycp";
@@ -77,8 +78,8 @@
seq = ManagedDialog();
Wizard::CloseDialog();
}
- Lan::proposal_valid = false; // repropose
- Lan::SetModified ();
+ LanItems::proposal_valid = false; // repropose
+ LanItems::SetModified ();
ret = $[
"workflow_sequence" : seq
Modified: trunk/network/src/clients/lan_auto.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/clients/lan_auto.ycp…
==============================================================================
--- trunk/network/src/clients/lan_auto.ycp (original)
+++ trunk/network/src/clients/lan_auto.ycp Mon Jul 2 16:53:49 2007
@@ -20,6 +20,7 @@
import "Mode";
import "Map";
import "NetworkDevices";
+import "LanItems";
include "network/lan/wizards.ycp";
include "network/routines.ycp";
@@ -234,7 +235,7 @@
}
else if (func == "Reset") {
Lan::Import($[]);
- Lan::UnsetModified ();
+ LanItems::UnsetModified ();
ret = $[];
}
else if (func == "Change") {
@@ -254,10 +255,10 @@
ret = Lan::AutoPackages ();
}
else if (func == "SetModified") {
- ret = Lan::SetModified ();
+ ret = LanItems::SetModified ();
}
else if (func == "GetModified") {
- ret = Lan::GetModified ();
+ ret = LanItems::GetModified ();
}
else if (func == "Export") {
map settings = Lan::Export();
@@ -270,10 +271,10 @@
Lan::PrepareForAutoinst();
Lan::Autoinstall();
ret = Lan::WriteOnly();
- if (Lan::autoinstall_settings["strict_IP_check_timeout"]:nil != nil)
+ if (LanItems::autoinstall_settings["strict_IP_check_timeout"]:nil != nil)
{
if (Lan::isAnyInterfaceDown()){
- integer timeout = Lan::autoinstall_settings["strict_IP_check_timeout"]:0;
+ integer timeout = LanItems::autoinstall_settings["strict_IP_check_timeout"]:0;
y2debug("timeout %1", timeout);
string error_text = _("Configuration Error : not initialized interface!");
if (timeout == 0) Popup::Error(error_text);
Modified: trunk/network/src/clients/lan_proposal.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/clients/lan_proposal…
==============================================================================
--- trunk/network/src/clients/lan_proposal.ycp (original)
+++ trunk/network/src/clients/lan_proposal.ycp Mon Jul 2 16:53:49 2007
@@ -21,7 +21,7 @@
import "Linuxrc";
import "Popup";
import "Progress";
-
+import "LanItems";
include "network/lan/wizards.ycp";
list args = WFM::Args();
@@ -37,8 +37,8 @@
symbol warning_level = nil;
boolean force_reset = param["force_reset"]:false;
- if(force_reset || !Lan::proposal_valid) {
- Lan::proposal_valid = true;
+ if(force_reset || !LanItems::proposal_valid) {
+ LanItems::proposal_valid = true;
/* Popup text */
BusyPopup(_("Detecting network cards..."));
boolean progress_orig = Progress::set (false);
Modified: trunk/network/src/clients/save_network.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/clients/save_network…
==============================================================================
--- trunk/network/src/clients/save_network.ycp (original)
+++ trunk/network/src/clients/save_network.ycp Mon Jul 2 16:53:49 2007
@@ -166,22 +166,6 @@
return "";
}
-map<string, any> getcfg(string options, string device){
- map <string, any> cfg=$[];
- map <string, any> output = (map <string, any>)SCR::Execute(.target.bash_output,
- sformat("getcfg %1 %2", options, device));
-// if (output["exit"]:0==0){
- foreach(string row, splitstring(output["stdout"]:"", "\n"), {
- row=deletechars(row, "\\\"\;");
- list<string> keyval=splitstring(row, "=");
- if (size(keyval)>1) cfg[keyval[0]:""]=keyval[1]:"";
-
- });
-// }
- y2milestone("%1 %2\n%3", options, device, cfg);
- return cfg;
-}
-
string getHWFullPath(string hwfile){
return sformat("%1/hwcfg-%2", "/etc/sysconfig/hardware", hwfile);
}
@@ -195,9 +179,13 @@
// read current hardware information and check if configuration file exists
hwcfg=getcfg("-f hwcfg- -d /etc/sysconfig/hardware", InstallInf["netdevice"]:"");
//y2internal("hwcfg %1", hwcfg);
+/*
foreach(map hw_temp, (list<map>)SCR::Read(.probe.netcard), {
if (hwcfg["HWD_DEVICEPATH"]:"" == sformat("/sys%1", hw_temp["sysfs_id"]:"")) hw=hw_temp;
});
+*/
+
+hw=getHardware(hwcfg["HWD_DEVICEPATH"]:"", (list<map>)SCR::Read(.probe.netcard));
y2milestone("hwinfo %1", hw);
@@ -249,29 +237,6 @@
return hwfile;
}
-string getIfcName(string hwfile){
- string ifcfg="";
- string interfacetype = NetworkDevices::device_type( hwcfg[sformat("HWD_INTERFACE_%1", tointeger(hwcfg["HWD_INTERFACE_N"]:"0")-1)]:"" );
- // for special s390 interface types write static configuration
- if (contains(["qeth", "hsi", "ctc", "lcs", "iucv"], interfacetype)){
- y2internal("special device type %1", interfacetype);
- ifcfg=sformat("ifcfg-%1", hwfile);
- } else {
- y2internal("usual type %1", interfacetype);
- // if MAC available - use it for name
- if (size(hwcfg["HWD_ID"]:"")>0){
- ifcfg = sformat("ifcfg-%1-id-%2", interfacetype, hwcfg["HWD_ID"]:"");
- y2internal("MAC address available - use it for name %1", ifcfg);
- } else {
- // in case MAC is not available, use device name (eth0)
- ifcfg = sformat("ifcfg-%1", hwcfg[sformat("HWD_INTERFACE_%1", tointeger(hwcfg["HWD_INTERFACE_N"]:"0")-1)]:"");
- y2internal("MAC address not available - use device name %1", ifcfg);
- }
- }
- y2internal("interface configuration file %1", ifcfg);
- return ifcfg;
-}
-
void CreateIfcfg(string hwcfg, string ifcfg){
string network_configuration="";
// set BOOTPROTO=[ static | dhcp ]
@@ -395,10 +360,10 @@
WFM::SCRSetDefault (old_SCR);
if(ReadInstallInf()){
- string hwcfg = CreateHardwareFile();
- string ifcfg = getIfcName(hwcfg);
+ string hwcfgname = CreateHardwareFile();
+ string ifcfg = getIfcName(hwcfgname, hwcfg[sformat("HWD_INTERFACE_%1", tointeger(hwcfg["HWD_INTERFACE_N"]:"0")-1)]:"" );
- CreateIfcfg(hwcfg, ifcfg);
+ CreateIfcfg(hwcfgname, ifcfg);
CreateOtherNetworkFiles();
SCR::Execute(.target.bash, "chkconfig network on");
Modified: trunk/network/src/dsl/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/dsl/dialogs.ycp?rev=…
==============================================================================
--- trunk/network/src/dsl/dialogs.ycp (original)
+++ trunk/network/src/dsl/dialogs.ycp Mon Jul 2 16:53:49 2007
@@ -21,6 +21,7 @@
import "Popup";
import "SuSEFirewall4Network";
import "Wizard";
+import "LanItems";
include "network/runtime.ycp";
include "network/routines.ycp";
@@ -124,9 +125,9 @@
string i = ifaces[0, 0, 0]:"";
y2milestone("i=%1", i);
Lan::Edit(i);
- Lan::bootproto = "";
- Lan::ipaddr = "";
- Lan::Commit();
+ LanItems::bootproto = "";
+ LanItems::ipaddr = "";
+ LanItems::Commit();
}
NetworkDevices::Pop();
}
Modified: trunk/network/src/lan/address.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/lan/address.ycp?rev=…
==============================================================================
--- trunk/network/src/lan/address.ycp (original)
+++ trunk/network/src/lan/address.ycp Mon Jul 2 16:53:49 2007
@@ -190,12 +190,13 @@
void initIfcfg (string key) {
- UI::ChangeWidget(`id(key), `Value, Lan::type);
+ UI::ChangeWidget(`id(key), `Value, LanItems::type);
UI::ChangeWidget(`id(key), `Enabled, false);
}
void initIfcfgId (string key) {
- UI::ChangeWidget(`id(key), `Value, Lan::device);
+ initHardware();
+ UI::ChangeWidget(`id(key), `Value, LanItems::Items[LanItems::current, "ifcfg"]:"" );
}
@@ -250,12 +251,12 @@
* @return whether valid
*/
boolean ValidateIfcfgType (string key, map event) {
- if (Lan::operation == `add)
+ if (LanItems::operation == `add)
{
string ifcfgtype = (string) UI::QueryWidget (`id (key), `Value);
// validate device type, misdetection
- if (ifcfgtype != Lan::type)
+ if (ifcfgtype != LanItems::type)
{
UI::SetFocus(`id (key));
if (!Popup::ContinueCancel (
@@ -465,13 +466,13 @@
],
"IFCFGID": $[
- "widget": `combobox,
+ "widget": `textentry,
/* ComboBox label */
"label": _("&Configuration Name"),
- "opt": [`hstretch, `editable],
+ "opt": [`hstretch, `disabled ],
"help": "",
"init" : initIfcfgId,
- "valid_chars": NetworkDevices::ValidCharsIfcfg (),
+// "valid_chars": NetworkDevices::ValidCharsIfcfg (),
// "handle": HandleIfcfg,
],
@@ -576,13 +577,13 @@
define any AddressDialog() {
ScreenName("lan-address");
- string ifname = NetworkDevices::device_name (Lan::type, Lan::device);
+ string ifname = NetworkDevices::device_name (LanItems::type, LanItems::device);
string fwzone = SuSEFirewall4Network::GetZoneOfInterface (ifname);
// If firewall is active and interface in no zone, nothing
// gets through (#62309) so add it to the external zone
if (fwzone == "" &&
- Lan::operation == `add &&
+ LanItems::operation == `add &&
SuSEFirewall4Network::IsOn () &&
SuSEFirewall4Network::UnconfiguredIsBlocked ())
{
@@ -596,20 +597,20 @@
// general tab:
// "IFNAME": ifname,
// "BINDTOHW": "mac", // FIXME
- "STARTMODE": Lan::startmode,
- "USERCONTROL": Lan::usercontrol,
+ "STARTMODE": LanItems::startmode,
+ "USERCONTROL": LanItems::usercontrol,
// problems when renaming the interface?
"FWZONE": fwzone,
- "MTU": Lan::mtu,
+ "MTU": LanItems::mtu,
// address tab:
- "BOOTPROTO": Lan::bootproto,
- "IPADDR": Lan::ipaddr,
- "NETMASK": Lan::netmask,
- "REMOTEIP": Lan::remoteip,
+ "BOOTPROTO": LanItems::bootproto,
+ "IPADDR": LanItems::ipaddr,
+ "NETMASK": LanItems::netmask,
+ "REMOTEIP": LanItems::remoteip,
- "IFCFGTYPE": Lan::type,
- "IFCFGID": Lan::device,
+ "IFCFGTYPE": LanItems::type,
+ "IFCFGID": LanItems::device,
];
@@ -619,12 +620,12 @@
boolean is_ptp = drvtype == "ctc" || drvtype == "iucv";
// TODO: dynamic for dummy. or add dummy from outside?
- boolean no_dhcp = is_ptp || settings["IFCFGTYPE"]:"" == "dummy" || Lan::alias != "";
+ boolean no_dhcp = is_ptp || settings["IFCFGTYPE"]:"" == "dummy" || LanItems::alias != "";
if(settings["BOOTPROTO"]:"" == "static" && settings["IPADDR"]:"" == "" && !no_dhcp) settings["BOOTPROTO"] = "dhcp";
// #65524
- if (Lan::operation == `add && force_static_ip)
+ if (LanItems::operation == `add && force_static_ip)
{
settings["BOOTPROTO"] = "static";
}
@@ -668,12 +669,12 @@
"IFCFGID",
`HSpacing(0.5)
);
- if(Lan::operation != `add) {
- if(Lan::alias == "") {
- settings["IFCFG"] = NetworkDevices::device_name(NetworkDevices::RealType(Lan::type, Lan::hotplug), Lan::device);
+ if(LanItems::operation != `add) {
+ if(LanItems::alias == "") {
+ settings["IFCFG"] = NetworkDevices::device_name(NetworkDevices::RealType(LanItems::type, LanItems::hotplug), LanItems::device);
}
else {
- settings["IFCFG"] = NetworkDevices::alias_name(NetworkDevices::RealType(Lan::type, Lan::hotplug), Lan::device, Lan::alias);
+ settings["IFCFG"] = NetworkDevices::alias_name(NetworkDevices::RealType(LanItems::type, LanItems::hotplug), LanItems::device, LanItems::alias);
}
}
@@ -703,7 +704,7 @@
`HStretch()
)));
- if(Lan::alias != "") frame2 = `VSpacing(0);
+ if(LanItems::alias != "") frame2 = `VSpacing(0);
term address_p2p_contents =
`Frame (
@@ -732,13 +733,13 @@
term bond = `MarginBox(1, 0, `Frame( "", `VBox("BONDSLAVE", "BONDOPTION")));
- if (Lan::type == "bond")
+ if (LanItems::type == "bond")
{
- settings["SLAVES"] = Lan::bond_slaves;
+ settings["SLAVES"] = LanItems::bond_slaves;
//get all eth devices
- map<string, map<string, map<string, any> > > devices = (map<string, map<string, map<string, any> > >)NetworkDevices::FilterDevices("");
- map<string, map<string, any> > avails= devices["eth"]:$[];
+ map<string, map<string, any> > avails = ((map<string, map<string, map<string, any> > >)NetworkDevices::FilterDevices(""))["eth"]:$[];
+// map<string, map<string, any> > avails = devices["eth"]:$[];
//filter the eth devices (BOOT_PROTO=none && START_MODE=off)
foreach (string num, map<string, any> value, avails,
@@ -747,14 +748,14 @@
wd["BONDSLAVE", "items"] = add (wd["BONDSLAVE", "items"]:[], [NetworkDevices::device_name("eth", num)] );
});
- settings["BONDOPTION"] = Lan::bond_option;
+ settings["BONDOPTION"] = LanItems::bond_option;
//fill up the drop list and make the default value first
wd["BONDOPTION", "items"] = filter(list<string> v, wd["BONDOPTION", "items"]:[],
{
- return v[0]:"" != Lan::bond_option;
+ return v[0]:"" != LanItems::bond_option;
});
- wd["BONDOPTION", "items"] = prepend(wd["BONDOPTION", "items"]:[], [Lan::bond_option]);
+ wd["BONDOPTION", "items"] = prepend(wd["BONDOPTION", "items"]:[], [LanItems::bond_option]);
}
@@ -763,7 +764,7 @@
just_address_contents,
frame2
);
- if (Lan::type == "bond")
+ if (LanItems::type == "bond")
{
address_contents = `VBox(
`Left(label),
@@ -869,8 +870,8 @@
settings["IFCFGID"]:"");
// general tab
- Lan::startmode = settings["STARTMODE"]:"";
- Lan::usercontrol = settings["USERCONTROL"]:false;
+ LanItems::startmode = settings["STARTMODE"]:"";
+ LanItems::usercontrol = settings["USERCONTROL"]:false;
if (fw_is_installed) {
string zone = settings["FWZONE"]:"";
@@ -879,39 +880,39 @@
SuSEFirewall4Network::ProtectByFirewall (ifcfgname, zone, zone != "");
}
- Lan::mtu = settings["MTU"]:"";
+ LanItems::mtu = settings["MTU"]:"";
// address tab
- if(Lan::operation == `add) {
- Lan::device = NetworkDevices::device_num(ifcfgname);
- Lan::type = NetworkDevices::device_type(ifcfgname);
+ if(LanItems::operation == `add) {
+ LanItems::device = NetworkDevices::device_num(ifcfgname);
+ LanItems::type = NetworkDevices::device_type(ifcfgname);
}
- Lan::bootproto = settings["BOOTPROTO"]:"";
- if (Lan::bootproto == "static") // #104494
+ LanItems::bootproto = settings["BOOTPROTO"]:"";
+ if (LanItems::bootproto == "static") // #104494
{
- Lan::ipaddr = settings["IPADDR"]:"";
- Lan::netmask = settings["NETMASK"]:"";
- Lan::remoteip = settings["REMOTEIP"]:"";
+ LanItems::ipaddr = settings["IPADDR"]:"";
+ LanItems::netmask = settings["NETMASK"]:"";
+ LanItems::remoteip = settings["REMOTEIP"]:"";
}
else
{
- Lan::ipaddr = "";
- Lan::netmask = "";
- Lan::remoteip = "";
+ LanItems::ipaddr = "";
+ LanItems::netmask = "";
+ LanItems::remoteip = "";
// fixed bug #73739 - if dhcp is used, dont set default gw statically
Routing::RemoveDefaultGw();
}
}
- if (Lan::type == "bond")
+ if (LanItems::type == "bond")
{
- Lan::bond_option = settings["BONDOPTION"]:"";
- Lan::bond_slaves = (list<string>)settings["SLAVES"]:[];
+ LanItems::bond_option = settings["BONDOPTION"]:"";
+ LanItems::bond_slaves = (list<string>)settings["SLAVES"]:[];
}
// proceed with WLAN settings if appropriate, #42420
- if (ret == `next && Lan::type == "wlan" && Lan::alias == "")
+ if (ret == `next && LanItems::type == "wlan" && LanItems::alias == "")
{
ret = `wire;
}
Modified: trunk/network/src/lan/cmdline.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/lan/cmdline.ycp?rev=…
==============================================================================
--- trunk/network/src/lan/cmdline.ycp (original)
+++ trunk/network/src/lan/cmdline.ycp Mon Jul 2 16:53:49 2007
@@ -18,12 +18,12 @@
import "RichText";
import "Report";
import "NetworkModules";
+import "LanItems";
list <map<string, any> > getConfigList(){
list <map<string, any> > confList = [];
integer count = 0;
- list<map<string,any> > overview = (list<map<string,any> >)Lan::Overview();
- overview = overview + Lan::Unconfigured ();
+ list<map<string,any> > overview = (list<map<string,any> >)LanItems::Overview();
foreach(map<string, any> row, overview, {
confList = add(confList, $[tostring(count) : $["id" : row["id"]:"",
"rich_descr" : row["rich_descr"]:"",
@@ -60,8 +60,8 @@
define boolean AddIface (integer hw_id) {
Lan::Add ();
- Lan::SelectHW (hw_id);
- Lan::SetDefaultsForHW ();
+ LanItems::SelectHW (hw_id);
+ LanItems::SetDefaultsForHW ();
// warn if selecting a card without a driver, #29296
// TODO also for DSL...
@@ -122,45 +122,45 @@
* @param options action options
*/
define boolean AddHandler(map<string, string> options) {
- Lan::type = options["type"]:"ethernet";
- if (!contains(["arcnet", "bluetooth", "dummy", "ethernet", "fddi", "myrinet", "token-ring", "usb", "wireless"], Lan::type)){
+ LanItems::type = options["type"]:"ethernet";
+ if (!contains(["arcnet", "bluetooth", "dummy", "ethernet", "fddi", "myrinet", "token-ring", "usb", "wireless"], LanItems::type)){
Report::Error(_("Not possible value for type!"));
return false;
}
- Lan::bootproto = options["bootproto"]:"none";
- if (!contains(["none", "static", "dhcp"], Lan::bootproto)){
+ LanItems::bootproto = options["bootproto"]:"none";
+ if (!contains(["none", "static", "dhcp"], LanItems::bootproto)){
Report::Error(_("Not possible value for bootproto!"));
return false;
}
- Lan::ipaddr = options["ip"]:"";
- Lan::netmask = options["netmask"]:"255.255.255.0";
- Lan::startmode = options["startmode"]:"auto";
- if (!contains(["auto", "ifplugd", "nfsroot"], Lan::startmode)){
+ LanItems::ipaddr = options["ip"]:"";
+ LanItems::netmask = options["netmask"]:"255.255.255.0";
+ LanItems::startmode = options["startmode"]:"auto";
+ if (!contains(["auto", "ifplugd", "nfsroot"], LanItems::startmode)){
Report::Error(_("Not possible value for startmode!"));
return false;
}
map<string, any> settings = $[
- "STARTMODE": Lan::startmode,
- "USERCONTROL": Lan::usercontrol,
+ "STARTMODE": LanItems::startmode,
+ "USERCONTROL": LanItems::usercontrol,
// problems when renaming the interface?
"FWZONE": "EXT",
- "MTU": Lan::mtu,
- "BOOTPROTO": Lan::bootproto,
- "IPADDR": Lan::ipaddr,
- "NETMASK": Lan::netmask,
- "REMOTEIP": Lan::remoteip,
- "IFCFGTYPE": Lan::type,
- "IFCFGID": Lan::device,
+ "MTU": LanItems::mtu,
+ "BOOTPROTO": LanItems::bootproto,
+ "IPADDR": LanItems::ipaddr,
+ "NETMASK": LanItems::netmask,
+ "REMOTEIP": LanItems::remoteip,
+ "IFCFGTYPE": LanItems::type,
+ "IFCFGID": LanItems::device,
];
y2internal("%1", settings);
- CommandLine::Print(Lan::type);
- CommandLine::Print(Lan::bootproto);
- CommandLine::Print(Lan::ipaddr);
- CommandLine::Print(Lan::netmask);
+ CommandLine::Print(LanItems::type);
+ CommandLine::Print(LanItems::bootproto);
+ CommandLine::Print(LanItems::ipaddr);
+ CommandLine::Print(LanItems::netmask);
/*
CommandLine::Print(sformat(_("Adding Device: %1"), dev));
@@ -202,7 +202,7 @@
} else
{
Lan::Edit(dev);
- if (Lan::startmode == "managed")
+ if (LanItems::startmode == "managed")
{
// Continue-Cancel popup
CommandLine::Print(_("The interface is currently set to be managed
@@ -215,48 +215,48 @@
if (!CommandLine::YesNo()) return false;
//
// TODO move the defaults to GetDefaultsForHW
- Lan::startmode = "ifplugd";
+ LanItems::startmode = "ifplugd";
}
}
- Lan::bootproto = options["bootproto"]:"none";
- if (!contains(["none", "static", "dhcp"], Lan::bootproto)){
+ LanItems::bootproto = options["bootproto"]:"none";
+ if (!contains(["none", "static", "dhcp"], LanItems::bootproto)){
Report::Error(_("Not possible value for bootproto!"));
return false;
}
- if (Lan::bootproto=="static"){
- Lan::ipaddr = options["ip"]:"";
- Lan::netmask = options["netmask"]:"";
+ if (LanItems::bootproto=="static"){
+ LanItems::ipaddr = options["ip"]:"";
+ LanItems::netmask = options["netmask"]:"";
} else{
- Lan::ipaddr = "";
- Lan::netmask = "";
+ LanItems::ipaddr = "";
+ LanItems::netmask = "";
}
- Lan::startmode = options["startmode"]:"auto";
- if (!contains(["auto", "ifplugd", "nfsroot"], Lan::startmode)){
+ LanItems::startmode = options["startmode"]:"auto";
+ if (!contains(["auto", "ifplugd", "nfsroot"], LanItems::startmode)){
Report::Error(_("Not possible value for startmode!"));
return false;
}
map<string, any> settings = $[
- "STARTMODE": Lan::startmode,
- "USERCONTROL": Lan::usercontrol,
+ "STARTMODE": LanItems::startmode,
+ "USERCONTROL": LanItems::usercontrol,
// problems when renaming the interface?
"FWZONE": "EXT",
- "MTU": Lan::mtu,
- "BOOTPROTO": Lan::bootproto,
- "IPADDR": Lan::ipaddr,
- "NETMASK": Lan::netmask,
- "REMOTEIP": Lan::remoteip,
- "IFCFGTYPE": Lan::type,
- "IFCFGID": Lan::device,
+ "MTU": LanItems::mtu,
+ "BOOTPROTO": LanItems::bootproto,
+ "IPADDR": LanItems::ipaddr,
+ "NETMASK": LanItems::netmask,
+ "REMOTEIP": LanItems::remoteip,
+ "IFCFGTYPE": LanItems::type,
+ "IFCFGID": LanItems::device,
];
CommandLine::Print(sformat("%1 : %2", _("Changing Configuration for"), dev));
- CommandLine::Print(sformat("%1 :\t%2", _("Device Type"), Lan::type));
- CommandLine::Print(sformat("%1 :\t%2", _("Bootproto"), Lan::bootproto));
- CommandLine::Print(sformat("%1 :\t%2",_("IP Address"), Lan::ipaddr));
- CommandLine::Print(sformat("%1 :\t%2",_("Mask"), Lan::netmask));
- Lan::Commit();
+ CommandLine::Print(sformat("%1 :\t%2", _("Device Type"), LanItems::type));
+ CommandLine::Print(sformat("%1 :\t%2", _("Bootproto"), LanItems::bootproto));
+ CommandLine::Print(sformat("%1 :\t%2",_("IP Address"), LanItems::ipaddr));
+ CommandLine::Print(sformat("%1 :\t%2",_("Mask"), LanItems::netmask));
+ LanItems::Commit();
return true;
}
@@ -270,9 +270,9 @@
foreach(map<string, any> row, config, {
foreach(string key, map<string, any> value, (map<string, map<string, any> >) row, {
if (key == options["id"]:"0"){
- string id = value["id"]:"";
- Lan::Delete(id);
- Lan::Commit();
+ LanItems::current = tointeger(value["id"]:-1);
+ Lan::Delete();
+ LanItems::Commit();
CommandLine::Print(_("The device was deleted."));
}
});
Modified: trunk/network/src/lan/complex.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/lan/complex.ycp?rev=…
==============================================================================
--- trunk/network/src/lan/complex.ycp (original)
+++ trunk/network/src/lan/complex.ycp Mon Jul 2 16:53:49 2007
@@ -28,6 +28,7 @@
import "TablePopup";
import "CWMTab";
import "Stage";
+import "LanItems";
include "network/routines.ycp";
include "network/summary.ycp";
@@ -42,7 +43,7 @@
* @return true if data was modified
*/
define boolean Modified() ``{
- boolean ret = Lan::Modified() || DNS::modified || Routing::Modified() ||
+ boolean ret = LanItems::Modified() || DNS::modified || Routing::Modified() ||
NetworkConfig::Modified();
return ret;
}
@@ -52,7 +53,7 @@
* @return always `next
*/
define symbol Commit() ``{
- Lan::Commit();
+ LanItems::Commit();
return `next;
}
@@ -103,19 +104,19 @@
if(!Modified()) return `next;
- Lan::SetModified();
+ LanItems::SetModified();
Wizard::RestoreHelp(help["write"]:"");
Lan::AbortFunction = ``{return PollAbort() && ReallyAbort();};
boolean ret = Lan::Write();
return ret ? `next : `abort;
}
-define boolean AddInterface (integer hwid) {
- //this is the map of kernel modules vs. requested firmware
+define boolean AddInterface () {
+ //this is the map of kernel modules vs. requested firmware
//non-empty keys are firmware packages shipped by SUSE
map <string, string> request_firmware = $[
- "atmel_pci" : "atmel-firmware",
- "atmel_cs" : "atmel-firmware",
+ "atmel_pci" : "atmel-firmware",
+ "atmel_cs" : "atmel-firmware",
"bcm43xx" : "",
"ipw2100" : "ipw-firmware",
"ipw2200" : "ipw-firmware",
@@ -126,13 +127,16 @@
"acx" : "",
"at76_usb" : "atmel-firmware",
"ipw3945" : "ipw-firmware",
- "rt61pci" : "",
+ "rt61pci" : "",
"rt73usb" : "",
+ "rt73" : "",
];
Lan::Add ();
- Lan::SelectHW (hwid);
- Lan::SetDefaultsForHW ();
+
+ LanItems::SelectHWMap(LanItems::Items[LanItems::current, "hwinfo"]:$[]);
+ LanItems::SetDefaultsForHW ();
+
// warn if selecting a card without a driver, #29296
// TODO also for DSL...
@@ -171,8 +175,8 @@
// - smpppd & kinternet: before net start
// - wlan firmware: here, just because it is copied from modems
// #45960
- if(Lan::Requires != [] && Lan::Requires != nil) {
- if(PackagesInstall(Lan::Requires) != `next)
+ if(LanItems::Requires != [] && LanItems::Requires != nil) {
+ if(PackagesInstall(LanItems::Requires) != `next)
return false;
}
return true;
@@ -208,18 +212,18 @@
string value_g = (string) UI::QueryWidget (`id (key), `CurrentButton);
boolean value = value_g == "managed";
if (NetworkService::IsManaged () != value)
- Lan::SetModified ();
+ LanItems::SetModified ();
NetworkService::SetManaged (value);
}
-list<map<string,any> > o_items = nil;
+//list<map<string,any> > o_items = nil;
void initOverview (string key) ``{
- o_items = (list<map<string,any> >)Lan::Overview();
- o_items = o_items + Lan::Unconfigured ();
+// o_items = (list<map<string,any> >)LanItems::Overview();
+
- list<term> term_items = maplist (map<string,any> i, o_items, {
- term t = `item (`id (i["id"]:""));
+ list<term> term_items = maplist (map<string,any> i, (list<map<string,any> >)LanItems::Overview(), {
+ term t = `item (`id (i["id"]:-1));
foreach (string l, i["table_descr"]:[], {
t = add (t, l);
});
@@ -234,39 +238,41 @@
UI::ChangeWidget (`id (b), `Enabled, false);
});
}
+ LanItems::current = (integer)UI::QueryWidget (`id (`_hw_items), `CurrentItem);
+ UI::ChangeWidget(`_hw_sum, `Value,LanItems::GetItemDescription());
}
symbol handleOverview( string key, map event ) {
- string current = (string)UI::QueryWidget (`id (`_hw_items), `CurrentItem);
+ LanItems::current = (integer)UI::QueryWidget (`id (`_hw_items), `CurrentItem);
- if (substring (current, 0, 1) == "-") // unconfigured
+ if (!LanItems::IsItemConfigured()) // unconfigured
UI::ChangeWidget(`id(`delete), `Enabled, false);
else UI::ChangeWidget(`id(`delete), `Enabled, true);
- foreach(map<string, any> row, o_items, {
- if (row["id"]:"" == current) UI::ChangeWidget(`_hw_sum, `Value,row["rich_descr"]:"");
- });
+ UI::ChangeWidget(`_hw_sum, `Value,LanItems::GetItemDescription());
if (event["EventReason"]:"" == "Activated")
{
switch ((symbol)event["ID"]:nil){
case `add:
Lan::Add();
+ LanItems::AddNew();
return `add;
case `edit:
- if (substring (current, 0, 1) == "-") // unconfigured
+ if (!LanItems::IsItemConfigured()) // unconfigured
{
- integer i = tointeger (substring (current, 1));
- if (! AddInterface (i)) break;
+ if (! AddInterface ()) break;
}
else // configured
{
- Lan::Edit(current);
+ LanItems::SetItem();
+/*
foreach(map<string, any> row, o_items, {
- if (row["id"]:"" == current && row["hw_num"]:-1 != -1) Lan::SelectHW(row["hw_num"]:-1);
+ if (row["id"]:-1 == LanItems::current && row["hw_num"]:-1 != -1) LanItems::SelectHW(row["hw_num"]:-1);
});
+*/
// Lan::SelectHW (1);
- if (Lan::startmode == "managed")
+ if (LanItems::startmode == "managed")
{
// Continue-Cancel popup
if (!Popup::ContinueCancel (_("The interface is currently set to be managed
@@ -280,30 +286,29 @@
}
//
// TODO move the defaults to GetDefaultsForHW
- Lan::startmode = "ifplugd";
+ LanItems::startmode = "ifplugd";
}
}
return `edit;
case `delete:
- if (substring (current, 0, 1) == "-") // unconfigured
- return nil;
+ if (!LanItems::IsItemConfigured()) return nil;
string pop = sformat(_("All additional addresses belonging to the interface %1
will be deleted as well.
Really continue?
-"), current);
- if(Lan::HasAliases(current) && Popup::YesNoHeadline(Label::WarningMsg(), pop) != true)
+"), LanItems::current);
+ if(LanItems::InterfaceHasAliases() && Popup::YesNoHeadline(Label::WarningMsg(), pop) != true)
break;
- Lan::Delete(current);
- Lan::Commit();
+ LanItems::DeleteItem();
+// LanItems::Commit();
initOverview("");
break;
}
}
- if (size(o_items)==0){
+ if (size(LanItems::Items)==0){
UI::ChangeWidget(`_hw_sum, `Value, "");
UI::ChangeWidget (`id (`edit), `Enabled, false);
UI::ChangeWidget (`id (`delete), `Enabled, false);
Modified: trunk/network/src/lan/hardware.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/lan/hardware.ycp?rev…
==============================================================================
--- trunk/network/src/lan/hardware.ycp (original)
+++ trunk/network/src/lan/hardware.ycp Mon Jul 2 16:53:49 2007
@@ -18,7 +18,7 @@
import "NetworkModules";
import "Popup";
import "Wizard";
-
+import "LanItems";
include "network/summary.ycp";
include "network/routines.ycp";
@@ -37,7 +37,7 @@
for example, <i>io=0x300 irq=5</i>. <b>Note:</b> If two cards are configured
with the same module name, options will be merged while saving.</p>");
- if(!(Lan::operation == `edit /* FIXME: unique || Lan::unique != "" */ || Arch::s390 () == true))
+ if(!(LanItems::operation == `edit /* FIXME: unique || Lan::unique != "" */ || Arch::s390 () == true))
{
/* Manual dialog help 3/4 */
@@ -64,34 +64,30 @@
}
map<string, any> hardware = nil;
-
+map<string, any> udev = nil;
boolean hw_standalone=false;
-void initHwDialog(string text) {
+void initHardware(){
hardware = $[];
-
- /* Manual dialog caption */
- string caption = _("Manual Network Card Configuration");
-
-
hardware["modul"] = NetworkModules::Alias; // FIXME: MOD Lan::Module["module"]:"";
hardware["options"] = NetworkModules::Options; // FIXME: MOD Lan::Module["options"]:"";
- hardware["hotplug"] = Lan::hotplug;
- y2milestone("hotplug=%1", Lan::hotplug);
- hardware["modules_from_hwinfo"] = Lan::getModulesFor(Lan::nm_name, hardware["modul"]:"" );
+ hardware["hotplug"] = LanItems::hotplug;
+ y2milestone("hotplug=%1", LanItems::hotplug);
+ hardware["modules_from_hwinfo"] = LanItems::GetItemModules(hardware["modul"]:"" );
- hardware["type"] = Lan::type;
+ hardware["type"] = LanItems::type;
if(hardware["type"]:"" == "") {
y2error("Shouldn't happen -- type is empty. Assuming eth.");
hardware["type"] = "eth";
}
hardware["realtype"] = NetworkDevices::RealType(hardware["type"]:"", hardware["hotplug"]:"");
- hardware["device"] = Lan::device;
- hardware["default_device"] = Lan::device;
+ hardware["device"] = LanItems::device;
+ hardware["default_device"] = LanItems::device;
// #38213, remember device id when we switch back from pcmcia/usb
hardware["non_hotplug_device_id"] = hardware["device"]:"";
- hardware["hwcfg"] = Lan::nm_name;
- if (!hasAnyValue(Lan::nm_name) && hasAnyValue(Lan::nm_name_old)) hardware["hwcfg"]=Lan::nm_name_old;
+ hardware["hwcfg"] = LanItems::nm_name;
+ if (!hasAnyValue(LanItems::nm_name) && hasAnyValue(LanItems::nm_name_old)) hardware["hwcfg"]=LanItems::nm_name_old;
+y2internal("hwcfg %1", hardware["hwcfg"]:"");
// FIXME duplicated in address.ycp
hardware["device_types"] = [ "arc", "bnep", "dummy", "eth", "fddi", "myri", "tr", "usb", "wlan", "bond" ];
@@ -105,7 +101,22 @@
if(issubstring(hardware["device"]:"", "bus-pcmcia")) hardware["hotplug"] = "pcmcia";
else if(issubstring(hardware["device"]:"", "bus-usb")) hardware["hotplug"] = "usb";
- y2milestone("hotplug=%1", Lan::hotplug);
+ y2milestone("hotplug=%1", LanItems::hotplug);
+
+ hardware["devices"] = LanItems::FreeDevices(hardware["realtype"]:""); // TODO: id-, bus-, ... here
+ if(!contains(hardware["devices"]:[], hardware["device"]:"")) hardware["devices"] = prepend(hardware["devices"]:[], hardware["device"]:"");
+
+ hardware["no_hotplug"] = hardware["hotplug"]:"" == "";
+ hardware["no_hotplug_dummy"] = hardware["no_hotplug"]:false && hardware["type"]:"" != "dummy";
+
+}
+
+void initHwDialog(string text) {
+
+ /* Manual dialog caption */
+ string caption = _("Manual Network Card Configuration");
+
+ initHardware();
term CheckBoxes = `HBox(
`HSpacing(1.5),
@@ -127,7 +138,7 @@
);
/* Disable PCMCIA and USB checkboxex on Edit and s390 */
- if(Lan::operation == `edit /* FIXME: unique || Lan::unique != "" */ || Arch::s390 () == true)
+ if(LanItems::operation == `edit /* FIXME: unique || Lan::unique != "" */ || Arch::s390 () == true)
CheckBoxes = `VSpacing(0);
// #116211 - allow user to change modules from list
@@ -147,8 +158,6 @@
`VSpacing(0.4)
),`HSpacing(0.5)));
- hardware["devices"] = Lan::FreeDevices(hardware["realtype"]:""); // TODO: id-, bus-, ... here
- if(!contains(hardware["devices"]:[], hardware["device"]:"")) hardware["devices"] = prepend(hardware["devices"]:[], hardware["device"]:"");
term DeviceNumberBox = `ReplacePoint(`id(`rnum),
/* TextEntry label */
@@ -174,16 +183,17 @@
/* Edit -> don't allow some changes */
// FIXME: devname if(true /* FIXME: devname Lan::operation == `edit */) {
- if(Lan::operation == `edit /* FIXME: unique || Lan::unique != "" */) {
+ if(LanItems::operation == `edit /* FIXME: unique || Lan::unique != "" */) {
TypeNameWidgets =
`Left(`HSquash(`Left(`VBox(
+/*
`HBox(
- /* Label text */
`HWeight(1, `Right(`Label(_("Configuration Name")))),
`HSpacing(0.5),
`HWeight(1, `Left(`Label(`opt(`outputField), NetworkDevices::device_name(hardware["realtype"]:"", hardware["device"]:""))))
),
+*/
`VSpacing(0.5),
`HBox(
/* Label text */
@@ -194,43 +204,60 @@
))));
}
- /* Frame label */
- term ButtonBox = `HBox(
- `HStretch(),
- `HSpacing(0.5),
- /* Pushbutton label */
- `PushButton(`id(`list), _("Select from &List")),
- `HSpacing(0.5),
- `HStretch()
- );
-
- term contents = `CheckBoxFrame(`id(`enable_hwcfg), caption, hardware["hwcfg"]:"" != "",
- `HBox(
- `HSpacing(2),
- `VBox(
+ term contents =
+ `VBox(
+ `Frame(_("Udev rules"),
+ `HBox(
+/*
+ `RadioButtonGroup(
+ `VBox(
+ `Left(`RadioButton(`id(0), "SYSFS{address}=='$MAC'", true)),
+ `Left(`RadioButton(`id(1), "KERNELS=='$BusID'" ))
+ )),
+*/
+ `TextEntry(`id(`udev_rule), _("Matching rule"), ""),
+ `TextEntry(`id(`device_name), _("Device Name"), "")
+ )
+ ),
+ `CheckBoxFrame(`id(`enable_hwcfg), caption, hardware["hwcfg"]:"" != "",
+ `HBox(
+ `HSpacing(2),
+ `VBox(
`VSpacing(0.5),
TypeNameWidgets,
`VSpacing(1.5),
KernelBox,
`VSpacing(1.5),
- ButtonBox,
+ `HBox(
+ `HStretch(),
+ `HSpacing(0.5),
+ /* Pushbutton label */
+ `PushButton(`id(`list), _("Select from &List")),
+ `HSpacing(0.5),
+ `HStretch()
+ ),
`VSpacing(0.5)
),
- `HSpacing(2),
- `VStretch()
- ));
+ `HSpacing(2),
+ `VStretch()
+ ))
+ );
UI::ReplaceWidget(`hw_content, contents);
-if (!hasAnyValue(Lan::nm_name) && hasAnyValue(Lan::nm_name_old)) UI::ChangeWidget(`enable_hwcfg, `Value, false);
- hardware["no_hotplug"] = hardware["hotplug"]:"" == "";
- hardware["no_hotplug_dummy"] = hardware["no_hotplug"]:false && hardware["type"]:"" != "dummy";
+if (!hasAnyValue(LanItems::nm_name) && hasAnyValue(LanItems::nm_name_old)) UI::ChangeWidget(`enable_hwcfg, `Value, false);
UI::ChangeWidget(`id(`modul), `Enabled, hardware["no_hotplug_dummy"]:false);
UI::ChangeWidget(`id(`options), `Enabled, hardware["no_hotplug_dummy"]:false);
ChangeWidgetIfExists(`id(`list), `Enabled, hardware["no_hotplug_dummy"]:false);
ChangeWidgetIfExists(`id(`hwcfg), `Enabled, hardware["no_hotplug"]:false);
ChangeWidgetIfExists(`id(`usb), `Enabled, (hardware["hotplug"]:"" == "usb" || hardware["hotplug"]:"" == "") && hardware["type"]:"" != "dummy");
ChangeWidgetIfExists(`id(`pcmcia), `Enabled, (hardware["hotplug"]:"" == "pcmcia" || hardware["hotplug"]:"" == "") && hardware["type"]:"" != "dummy");
+ UI::ChangeWidget(`id(`udev_rule), `Enabled, false);
+ UI::ChangeWidget(`id(`device_name), `Enabled, false);
+
+ UI::ChangeWidget(`id(`udev_rule), `Value, LanItems::GetItemUdev()[0]:"");
+ UI::ChangeWidget(`id(`device_name), `Value, LanItems::GetItemUdev()[1]:"");
+
if (!hw_standalone) ChangeWidgetIfExists(`id(`dev), `Enabled,false);
ChangeWidgetIfExists(`id(`num), `ValidChars, NetworkDevices::ValidCharsIfcfg ());
ChangeWidgetIfExists(`id(`hwcfg), `ValidChars, NetworkModules::ValidCharsHwcfg ());
@@ -246,7 +273,7 @@
ScreenName("lan-hardware-selection");
- string type = Lan::type;
+ string type = LanItems::type;
integer selected = 0;
/* map NetworkCards */
@@ -321,7 +348,7 @@
selected = (integer) UI::QueryWidget(`id(`cards), `CurrentItem);
if(selected == nil) selected = 0;
map card = hwlist[selected]:$[];
- Lan::description = card["name"]:"";
+ LanItems::description = card["name"]:"";
NetworkModules::Alias /* FIXME: MOD Lan::Module["module"] */ = card["module"]:"";
NetworkModules::Options /* FIXME: MOD Lan::Module["options"] */ = card["options"]:"";
@@ -336,7 +363,7 @@
symbol handleHW (string key, map event) {
symbol ret=nil;
if (event["EventReason"]:"" == "ValueChanged" || event["EventReason"]:"" == "Activated") ret = (symbol)event["WidgetID"]:nil;
-if (ret == `list) SelectionDialog();
+ if (ret == `list) SelectionDialog();
if(ret == `pcmcia || ret == `usb || ret == `dev) {
@@ -424,21 +451,23 @@
void storeHW (string key, map event) {
if(!(boolean)UI::QueryWidget(`enable_hwcfg, `Value))
{
- NetworkModules::DeleteM(Lan::nm_name);
- if(size(Lan::nm_name_old)==0) Lan::nm_name_old = Lan::nm_name;
- Lan::nm_name="";
+ NetworkModules::DeleteM(LanItems::nm_name);
+ if(size(LanItems::nm_name_old)==0) LanItems::nm_name_old = LanItems::nm_name;
+ LanItems::nm_name="";
NetworkDevices::Current["_nm_name"]="";
+ string tmp_name = NetworkDevices::Name;
NetworkDevices::Commit();
+ NetworkDevices::Select(tmp_name);
} else {
if(UI::WidgetExists(`id(`hwcfg))) {
- Lan::nm_name_old = Lan::nm_name;
- Lan::nm_name = (string) UI::QueryWidget(`id(`hwcfg), `Value);
+ LanItems::nm_name_old = LanItems::nm_name;
+ LanItems::nm_name = (string) UI::QueryWidget(`id(`hwcfg), `Value);
}
if(UI::WidgetExists(`id(`hwcfg))) {
hardware["hwcfg"] = (string) UI::QueryWidget (`id (`hwcfg), `Value);
- if (Lan::operation == `add || hardware["hwcfg"]:"" != Lan::nm_name) {
+ if (LanItems::operation == `add || hardware["hwcfg"]:"" != LanItems::nm_name) {
if (contains (NetworkModules::ListM(""), hardware["hwcfg"]:"")) {
UI::SetFocus (`id (`hwcfg));
/* Popup text */
@@ -448,9 +477,9 @@
}
}
- if(Lan::operation == `add && UI::WidgetExists(`id(`num))) {
+ if(LanItems::operation == `add && UI::WidgetExists(`id(`num))) {
string nm = (string) UI::QueryWidget(`id(`num), `Value);
- if(Lan::operation == `add || (hardware["device"]:"" != Lan::device && hardware["type"]:"" != Lan::type)) {
+ if(LanItems::operation == `add || (hardware["device"]:"" != LanItems::device && hardware["type"]:"" != LanItems::type)) {
if(contains(NetworkDevices::List(""), NetworkDevices::device_name(hardware["type"]:"", nm))) {
/* Popup text */
Popup::Error(sformat(_("Configuration name %1 (%2) already exists.
@@ -469,21 +498,21 @@
if(UI::WidgetExists(`id(`num)))
- Lan::device = (string) UI::QueryWidget(`id(`num), `Value);
+ LanItems::device = (string) UI::QueryWidget(`id(`num), `Value);
if(UI::WidgetExists(`id(`pcmcia)) || UI::WidgetExists(`id(`usb))) {
if(UI::QueryWidget(`id(`pcmcia), `Value) == true)
- Lan::hotplug = "pcmcia";
+ LanItems::hotplug = "pcmcia";
else if(UI::QueryWidget(`id(`usb), `Value) == true)
- Lan::hotplug = "usb";
+ LanItems::hotplug = "usb";
else
- Lan::hotplug = "";
+ LanItems::hotplug = "";
}
- Lan::hotplug = "";
+ LanItems::hotplug = "";
if(UI::WidgetExists(`id(`dev))) {
hardware["type"] = (string) UI::QueryWidget(`id(`dev), `Value);
- Lan::type = hardware["type"]:"";
+ LanItems::type = hardware["type"]:"";
}
}
@@ -499,22 +528,22 @@
/* S/390 dialog caption */
string caption = _("S/390 Network Card Configuration");
- string drvtype = DriverType (Lan::type);
+ string drvtype = DriverType (LanItems::type);
string helptext = "";
term contents = `Empty ();
- if(Lan::type == "qeth") {
+ if(LanItems::type == "qeth") {
contents = `HBox(
`HSpacing(6),
/* Frame label */
`Frame(_("S/390 Device Settings"), `HBox(`HSpacing(2), `VBox(
`VSpacing(1),
/* TextEntry label */
- `TextEntry(`id(`chan_mode), _("&Port Name"), Lan::chan_mode),
+ `TextEntry(`id(`chan_mode), _("&Port Name"), LanItems::chan_mode),
`VSpacing(1),
/* TextEntry label */
- `TextEntry(`id(`qeth_options), Label::Options (), Lan::qeth_options),
+ `TextEntry(`id(`qeth_options), Label::Options (), LanItems::qeth_options),
`VSpacing(1),
/* CheckBox label */
`Left(`CheckBox(`id(`ipa_takeover), _("&Enable IPA Takeover"))),
@@ -522,7 +551,7 @@
/* CheckBox label */
`Left(`CheckBox(`id(`qeth_layer2), `opt(`notify), _("Enable &Layer 2 Support"))),
/* TextEntry label */
- `TextEntry(`id(`qeth_macaddress), _("Layer2 &MAC Address"), Lan::qeth_macaddress),
+ `TextEntry(`id(`qeth_macaddress), _("Layer2 &MAC Address"), LanItems::qeth_macaddress),
`VSpacing(1)
), `HSpacing(2))),
`HSpacing(6)
@@ -536,14 +565,14 @@
_("<p>Enter the <b>Layer 2 MAC Address</b> if this card has been configured with layer 2 support.</p>");
}
- if(Lan::type == "hsi") {
+ if(LanItems::type == "hsi") {
contents = `HBox(
`HSpacing(6),
/* Frame label */
`Frame(_("S/390 Device Settings"), `HBox(`HSpacing(2), `VBox(
`VSpacing(1),
/* TextEntry label */
- `TextEntry(`id(`qeth_options), Label::Options (), Lan::qeth_options),
+ `TextEntry(`id(`qeth_options), Label::Options (), LanItems::qeth_options),
`VSpacing(1),
/* CheckBox label */
`Left(`CheckBox(`id(`ipa_takeover), _("&Enable IPA Takeover"))),
@@ -551,7 +580,7 @@
/* CheckBox label */
`Left(`CheckBox(`id(`qeth_layer2), `opt(`notify), _("Enable &Layer 2 Support"))),
/* TextEntry label */
- `TextEntry(`id(`qeth_macaddress), _("Layer2 &MAC Address"), Lan::qeth_macaddress),
+ `TextEntry(`id(`qeth_macaddress), _("Layer2 &MAC Address"), LanItems::qeth_macaddress),
`VSpacing(1)
), `HSpacing(2))),
`HSpacing(6)
@@ -570,10 +599,10 @@
`Frame(_("S/390 Device Settings"), `HBox(`HSpacing(2), `VBox(
`VSpacing(1),
/* TextEntry label */
- `TextEntry(`id(`chan_mode), _("&Port Number"), Lan::chan_mode),
+ `TextEntry(`id(`chan_mode), _("&Port Number"), LanItems::chan_mode),
`VSpacing(1),
/* TextEntry label */
- `TextEntry(`id(`lcs_timeout), _("&LANCMD Time-Out"), Lan::lcs_timeout)
+ `TextEntry(`id(`lcs_timeout), _("&LANCMD Time-Out"), LanItems::lcs_timeout)
), `HSpacing(2))),
`HSpacing(6)
);
@@ -631,22 +660,22 @@
Label::BackButton(), Label::NextButton());
if (drvtype == "ctc")
- UI::ChangeWidget(`id(`chan_mode), `Value, Lan::chan_mode);
+ UI::ChangeWidget(`id(`chan_mode), `Value, LanItems::chan_mode);
if (drvtype == "lcs")
{
- UI::ChangeWidget(`id(`chan_mode), `Value, Lan::chan_mode);
- UI::ChangeWidget(`id(`lcs_timeout), `Value, Lan::lcs_timeout);
+ UI::ChangeWidget(`id(`chan_mode), `Value, LanItems::chan_mode);
+ UI::ChangeWidget(`id(`lcs_timeout), `Value, LanItems::lcs_timeout);
}
if (drvtype == "qeth")
{
- UI::ChangeWidget(`id(`ipa_takeover), `Value, Lan::ipa_takeover);
- UI::ChangeWidget(`id(`qeth_layer2), `Value, Lan::qeth_layer2);
+ UI::ChangeWidget(`id(`ipa_takeover), `Value, LanItems::ipa_takeover);
+ UI::ChangeWidget(`id(`qeth_layer2), `Value, LanItems::qeth_layer2);
UI::ChangeWidget(`id(`qeth_macaddress), `ValidChars, ":0123456789abcdefABCDEF");
}
- if (Lan::type != "hsi")
+ if (LanItems::type != "hsi")
UI::SetFocus(`id(`chan_mode));
else
UI::SetFocus(`id(`qeth_options));
@@ -683,20 +712,20 @@
}
if(ret == `next) {
- if(Lan::type == "iucv") {
+ if(LanItems::type == "iucv") {
// #176330, must be static
- Lan::nm_name = "static-iucv-id-" + (string) UI::QueryWidget(`id(`chan_mode), `Value);
- Lan::device = "id-" + (string) UI::QueryWidget(`id(`chan_mode), `Value);
+ LanItems::nm_name = "static-iucv-id-" + (string) UI::QueryWidget(`id(`chan_mode), `Value);
+ LanItems::device = "id-" + (string) UI::QueryWidget(`id(`chan_mode), `Value);
}
- else if (Lan::type != "hsi")
- Lan::chan_mode = (string) UI::QueryWidget(`id(`chan_mode), `Value);
- if(Lan::type == "lcs")
- Lan::lcs_timeout = (string) UI::QueryWidget(`id(`lcs_timeout), `Value);
- if(Lan::type == "qeth" || Lan::type == "hsi") {
- Lan::qeth_options = (string) UI::QueryWidget(`id(`qeth_options), `Value);
- Lan::ipa_takeover = (boolean) UI::QueryWidget(`id(`ipa_takeover), `Value);
- Lan::qeth_layer2 = (boolean) UI::QueryWidget(`id(`qeth_layer2), `Value);
- Lan::qeth_macaddress = (string) UI::QueryWidget(`id(`qeth_macaddress), `Value);
+ else if (LanItems::type != "hsi")
+ LanItems::chan_mode = (string) UI::QueryWidget(`id(`chan_mode), `Value);
+ if(LanItems::type == "lcs")
+ LanItems::lcs_timeout = (string) UI::QueryWidget(`id(`lcs_timeout), `Value);
+ if(LanItems::type == "qeth" || LanItems::type == "hsi") {
+ LanItems::qeth_options = (string) UI::QueryWidget(`id(`qeth_options), `Value);
+ LanItems::ipa_takeover = (boolean) UI::QueryWidget(`id(`ipa_takeover), `Value);
+ LanItems::qeth_layer2 = (boolean) UI::QueryWidget(`id(`qeth_layer2), `Value);
+ LanItems::qeth_macaddress = (string) UI::QueryWidget(`id(`qeth_macaddress), `Value);
}
}
Modified: trunk/network/src/lan/virtual.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/lan/virtual.ycp?rev=…
==============================================================================
--- trunk/network/src/lan/virtual.ycp (original)
+++ trunk/network/src/lan/virtual.ycp Mon Jul 2 16:53:49 2007
@@ -66,7 +66,7 @@
list<term> table_items = [];
/* make ui items from the aliases list */
- maplist(string alias, map data, (map<string,map>) Lan::aliases, {
+ maplist(string alias, map data, (map<string,map>) LanItems::aliases, {
table_items = add(table_items, `item(`id(size(table_items)), alias, data["IPADDR"]:"", data["NETMASK"]:""));
});
@@ -92,7 +92,7 @@
{
case `edit :
term item = nil;
- maplist(string alias, map data, (map<string,map>) Lan::aliases, {
+ maplist(string alias, map data, (map<string,map>) LanItems::aliases, {
item = `item(`id(size(table_items)), alias, data["IPADDR"]:"", data["NETMASK"]:"");
});
@@ -140,13 +140,13 @@
if (!NetworkService::IsManaged())
{
list<term> table_items = (list<term>) UI::QueryWidget(`id(`table), `Items);
- map aliases_to_delete = Lan::aliases; // #48191
- Lan::aliases = $[];
+ map aliases_to_delete = LanItems::aliases; // #48191
+ LanItems::aliases = $[];
maplist(term e, table_items, {
map alias = $[];
alias["IPADDR"] = e[2]:"";
alias["NETMASK"] = e[3]:"";
- Lan::aliases[e[1]:""] = alias;
+ LanItems::aliases[e[1]:""] = alias;
aliases_to_delete[e[1]:""] = nil;
});
foreach (string a, any v, (map <string, any>)aliases_to_delete, {
Modified: trunk/network/src/lan/wireless.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/lan/wireless.ycp?rev…
==============================================================================
--- trunk/network/src/lan/wireless.ycp (original)
+++ trunk/network/src/lan/wireless.ycp Mon Jul 2 16:53:49 2007
@@ -15,6 +15,7 @@
import "FileUtils";
import "Label";
import "Lan";
+import "LanItems";
import "Map";
import "Message";
import "Popup";
@@ -287,21 +288,21 @@
add them manually. Refer to the file 'wireless' in the same directory for all
available options.</p>");
- string mode = Lan::wl_mode;
- string essid = Lan::wl_essid;
- string authmode = Lan::wl_auth_mode;
+ string mode = LanItems::wl_mode;
+ string essid = LanItems::wl_essid;
+ string authmode = LanItems::wl_auth_mode;
// wpa or wep?
boolean authmode_wpa = authmode == "psk" || authmode == "eap"; // shortcut
string key = nil;
string type = nil;
if (authmode == "psk")
{
- key = Lan::wl_wpa_psk;
+ key = LanItems::wl_wpa_psk;
type = (size (key) == 64)? "hex": "passphrase";
}
else if (authmode != "eap")
{
- map<string, string> wkey = ParseWepKey (Lan::wl_key[Lan::wl_default_key]:"");
+ map<string, string> wkey = ParseWepKey (LanItems::wl_key[LanItems::wl_default_key]:"");
key = wkey["key"]:"";
type = wkey["type"]:"";
}
@@ -310,7 +311,7 @@
key = ""; // and type is not used
}
- list<integer> key_lengths = ParseKeyLengths (Lan::wl_enc_modes);
+ list<integer> key_lengths = ParseKeyLengths (LanItems::wl_enc_modes);
/* Wireless dialog contents */
term contents = `HBox(
@@ -336,7 +337,7 @@
`ComboBox (`id (`authmode), `opt (`hstretch, `notify),
/* ComboBox label */
_("&Authentication Mode"),
- AuthModeItems (Lan::wl_auth_modes)),
+ AuthModeItems (LanItems::wl_auth_modes)),
`VSpacing(0.2),
type_w,
`VSpacing(0.2),
@@ -485,16 +486,16 @@
}
if(ret == `next || ret == `expert || ret == `keys) {
- Lan::wl_essid = (string) UI::QueryWidget(`id(`essid), `Value);
- Lan::wl_mode = mode;
- Lan::wl_auth_mode = authmode;
+ LanItems::wl_essid = (string) UI::QueryWidget(`id(`essid), `Value);
+ LanItems::wl_mode = mode;
+ LanItems::wl_auth_mode = authmode;
if (authmode == "psk")
{
- Lan::wl_wpa_psk = key;
+ LanItems::wl_wpa_psk = key;
}
else if (!authmode_wpa)
{
- Lan::wl_key[Lan::wl_default_key] = ckey;
+ LanItems::wl_key[LanItems::wl_default_key] = ckey;
}
}
@@ -550,27 +551,27 @@
/* Combobox label */
term freq = `ComboBox(`id(`frequency), `opt(`hstretch), _("&Frequency"), [
/* Combobox item */
- `item(`id("Automatic"), _("Automatic"), Lan::wl_frequency == ""),
- `item(`id("Automatic"), "FIXME: ASK jg(a)suse.de", Lan::wl_frequency != ""),
+ `item(`id("Automatic"), _("Automatic"), LanItems::wl_frequency == ""),
+ `item(`id("Automatic"), "FIXME: ASK jg(a)suse.de", LanItems::wl_frequency != ""),
]);
list channels = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", ];
- if (Lan::wl_channels != nil)
+ if (LanItems::wl_channels != nil)
{
- channels = Lan::wl_channels;
+ channels = LanItems::wl_channels;
}
- if(Lan::wl_channel != "" && !contains(channels, Lan::wl_channel))
- channels = prepend(channels, Lan::wl_channel);
+ if(LanItems::wl_channel != "" && !contains(channels, LanItems::wl_channel))
+ channels = prepend(channels, LanItems::wl_channel);
/* Combobox item */
channels = prepend(channels, `item(`id(""), _("Automatic")));
list bitrates = [ "54", "48", "36", "24", "18", "12", "11", "9", "6", "5.5", "2", "1" ];
- if (Lan::wl_bitrates != nil)
+ if (LanItems::wl_bitrates != nil)
{
- bitrates = Lan::wl_bitrates;
+ bitrates = LanItems::wl_bitrates;
}
- if(Lan::wl_bitrate != "" && !contains(bitrates, Lan::wl_bitrate))
- bitrates = prepend(bitrates, Lan::wl_bitrate);
+ if(LanItems::wl_bitrate != "" && !contains(bitrates, LanItems::wl_bitrate))
+ bitrates = prepend(bitrates, LanItems::wl_bitrate);
/* Combobox item */
bitrates = prepend(bitrates, `item(`id(""), _("Automatic")));
@@ -591,10 +592,10 @@
`ComboBox(`id(`bitrate), `opt(`hstretch), _("B&it Rate"), bitrates),
`VSpacing(0.2),
/* Text entry label */
- `TextEntry(`id(`accesspoint), _("&Access Point"), Lan::wl_accesspoint),
+ `TextEntry(`id(`accesspoint), _("&Access Point"), LanItems::wl_accesspoint),
`VSpacing(0.2),
/* CheckBox label */
- `Left(`CheckBox(`id(`power), _("Use &Power Management"), Lan::wl_power == true)),
+ `Left(`CheckBox(`id(`power), _("Use &Power Management"), LanItems::wl_power == true)),
`VSpacing(1)
), `HSpacing(2))),
`VSpacing(0.5)
@@ -605,10 +606,10 @@
Wizard::SetContentsButtons(caption, contents, helptext,
Label::BackButton(), Label::OKButton());
- UI::ChangeWidget(`id(`bitrate), `Value, Lan::wl_bitrate);
- UI::ChangeWidget(`id(`channel), `Value, Lan::wl_channel);
+ UI::ChangeWidget(`id(`bitrate), `Value, LanItems::wl_bitrate);
+ UI::ChangeWidget(`id(`channel), `Value, LanItems::wl_channel);
// #88530
- boolean channel_changeable = contains (["Ad-hoc", "Master"], Lan::wl_mode);
+ boolean channel_changeable = contains (["Ad-hoc", "Master"], LanItems::wl_mode);
UI::ChangeWidget (`id (`channel), `Enabled, channel_changeable);
any ret = nil;
@@ -633,11 +634,11 @@
}
if(ret == `next) {
- Lan::wl_channel = (string) UI::QueryWidget(`id(`channel), `Value);
-// Lan::wl_frequency = (string) UI::QueryWidget(`id(`frequency), `Value);
- Lan::wl_bitrate = (string) UI::QueryWidget(`id(`bitrate), `Value);
- Lan::wl_accesspoint = (string) UI::QueryWidget(`id(`accesspoint), `Value);
- Lan::wl_power = (boolean) UI::QueryWidget(`id(`power), `Value) == true;
+ LanItems::wl_channel = (string) UI::QueryWidget(`id(`channel), `Value);
+// LanItems::wl_frequency = (string) UI::QueryWidget(`id(`frequency), `Value);
+ LanItems::wl_bitrate = (string) UI::QueryWidget(`id(`bitrate), `Value);
+ LanItems::wl_accesspoint = (string) UI::QueryWidget(`id(`accesspoint), `Value);
+ LanItems::wl_power = (boolean) UI::QueryWidget(`id(`power), `Value) == true;
}
return ret;
@@ -779,16 +780,16 @@
value to 64.</p>") +
"";
- string length = Lan::wl_key_length;
+ string length = LanItems::wl_key_length;
list<string> ui_key_lengths = maplist (integer kl,
- ParseKeyLengths (Lan::wl_enc_modes),
+ ParseKeyLengths (LanItems::wl_enc_modes),
``( tostring (kl + 24) ));
if (!contains (ui_key_lengths, length))
{
ui_key_lengths = add (ui_key_lengths, length);
}
- list<string> keys = Lan::wl_key;
- integer defaultk = FindGoodDefault (keys, Lan::wl_default_key);
+ list<string> keys = LanItems::wl_key;
+ integer defaultk = FindGoodDefault (keys, LanItems::wl_default_key);
/* Wireless keys dialog contents */
term contents = `HBox(
@@ -868,9 +869,9 @@
}
if(ret == `next) {
- Lan::wl_key_length = length;
- Lan::wl_key = keys;
- Lan::wl_default_key = defaultk;
+ LanItems::wl_key_length = length;
+ LanItems::wl_key = keys;
+ LanItems::wl_default_key = defaultk;
}
return ret;
@@ -884,7 +885,7 @@
*/
define void InitializeWidget (string key) {
// the "" serves instead of a default constructor for wl_wpa_eap
- any value = Lan::wl_wpa_eap[key]:"";
+ any value = LanItems::wl_wpa_eap[key]:"";
my2debug ("AW", sformat ("init k: %1, v: %2", key, value));
UI::ChangeWidget (`id (key), ValueProp (key), value);
}
@@ -897,7 +898,7 @@
define void StoreWidget (string key, map event) {
any value = UI::QueryWidget (`id (key), ValueProp (key));
my2debug ("AW", sformat ("store k: %1, v: %2, e: %3", key, value, event));
- Lan::wl_wpa_eap[key] = value;
+ LanItems::wl_wpa_eap[key] = value;
}
/**
@@ -946,7 +947,7 @@
// inherited
InitializeWidget (key);
// enable/disable
- string mode = Lan::wl_wpa_eap["WPA_EAP_MODE"]:"";
+ string mode = LanItems::wl_wpa_eap["WPA_EAP_MODE"]:"";
UI::ChangeWidget (`id (key), `Enabled, mode == "peap");
}
@@ -1317,7 +1318,7 @@
"TTLS": ["", "MD5", "GTC", "CHAP", "PAP", "MSCHAP", "MSCHAPV2"],
"PEAP": ["", "MD5", "GTC", "MSCHAPV2"],
];
- string mode = Lan::wl_wpa_eap["WPA_EAP_MODE"]:"";
+ string mode = LanItems::wl_wpa_eap["WPA_EAP_MODE"]:"";
map<string, map<string,any> > wd = wpa_eap_widget_descr;
wd["WPA_EAP_AUTH", "items"] = maplist (string i, auth_items[mode]:[],
Modified: trunk/network/src/lan/wizards.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/lan/wizards.ycp?rev=…
==============================================================================
--- trunk/network/src/lan/wizards.ycp (original)
+++ trunk/network/src/lan/wizards.ycp Mon Jul 2 16:53:49 2007
@@ -145,7 +145,6 @@
* @return sequence result
*/
define symbol NetworkCardSequence(string action) ``{
-
map aliases = $[
"hardware" : ``(HardwareDialog()),
"address" : ``(AddressSequence("")),
@@ -156,7 +155,7 @@
if(action == "add") ws_start = "hardware";
/* All S/390 network devices */
- if(Arch::s390 () && Lan::operation == `add && Lan::unique != "") {
+ if(Arch::s390 () && LanItems::operation == `add && LanItems::unique != "") {
ws_start = "s390";
}
@@ -187,7 +186,7 @@
define symbol AddressSequence(string which) ``{
map aliases = $[
- "changedefaults": [ ``(ChangeDefaults()), true ],
+// "changedefaults": [ ``(ChangeDefaults()), true ],
"address" : ``(AddressDialog()),
"hosts" : ``(HostsMainDialog(false)),
"proxy" : ``(ProxyMainDialog(false)),
@@ -200,12 +199,14 @@
"commit" : [ ``(Commit()), true ],
];
- string ws_start = which == "wire"? "wire": "changedefaults";
+ string ws_start = which == "wire"? "wire": "address"; //"changedefaults";
map sequence = $[
"ws_start" : ws_start,
+/*
"changedefaults" : $[
`next : "address",
],
+*/
"address" : $[
`abort : `abort,
`next : "commit",
Modified: trunk/network/src/modules/Lan.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/modules/Lan.ycp?rev=…
==============================================================================
--- trunk/network/src/modules/Lan.ycp (original)
+++ trunk/network/src/modules/Lan.ycp Mon Jul 2 16:53:49 2007
@@ -38,6 +38,7 @@
import "SuSEFirewall4Network";
import "FileUtils";
import "PackageSystem";
+import "LanItems";
include "network/complex.ycp";
include "network/runtime.ycp";
@@ -45,122 +46,26 @@
/*-------------*/
/* GLOBAL DATA */
+boolean write_only = false;
+
/**
* Current module information
*/
// FIXME: MOD global map Module = $[];
-// used at autoinstallation time
-global map autoinstall_settings = $[];
-
/**
* autoinstallation: if true, write_only is disabled and the network settings
* are applied at once, like during the normal installation. #128810, #168806
*/
boolean start_immediately = false;
-global string description = "";
-global string unique = "";
-
-global string type = "";
-global string device = "";
-global string alias = "";
// ipv6 module
global boolean ipv6=true;
/**
* Hotplug type ("" if not hot pluggable)
*/
-global string hotplug = "";
-
-global list<string> Requires = [];
-
-/* address options */
-/** boot protocol: BOOTPROTO */
-global string bootproto = "static";
-global string ipaddr = "";
-global string remoteip = "";
-global string netmask = "";
-
-global string startmode = "auto";
-global boolean usercontrol = false;
-global string mtu = "";
-global string ethtool_options = "";
-
-/* wireless options */
-global string wl_mode = "";
-global string wl_essid = "";
-global string wl_nwid = "";
-global string wl_auth_mode = "";
-// when adding another key, don't forget the chmod 600 in NetworkDevices
-global string wl_wpa_psk = "";
-global string wl_key_length = "";
-global list<string> wl_key = [];
-global integer wl_default_key = 0;
-global string wl_nick = "";
-
-//bond options
-global list<string> bond_slaves = [];
-global string bond_option="";
-/**
- * wl_wpa_eap aggregates the settings in a map for easier CWM access.
- * @struct wpa_eap
- * WPA_EAP_MODE: string ("TTLS" "PEAP" or "TLS")
- * WPA_EAP_IDENTITY: string
- * WPA_EAP_PASSWORD: string (for TTLS and PEAP)
- * WPA_EAP_ANONID: string (for TTLS and PEAP)
- * WPA_EAP_CLIENT_CERT: string (for TLS, file name)
- * WPA_EAP_CLIENT_KEY: string (for TLS, file name)
- * WPA_EAP_CLIENT_KEY_PASSWORD: string (for TLS)
- * WPA_EAP_CA_CERT: string (file name)
- * WPA_EAP_AUTH: string ("", "MD5", "GTC", "CHAP"*, "PAP"*, "MSCHAP"*, "MSCHAPV2") (*: TTLS only)
- * WPA_EAP_PEAP_VERSION: string ("", "0", "1")
- */
-global map<string, any> wl_wpa_eap = $[];
-global string wl_channel = "";
-global string wl_frequency = "";
-global string wl_bitrate = "";
-global string wl_accesspoint = "";
-global boolean wl_power = true;
-
-// Card Features from hwinfo
-// if not provided, we use the default full list
-global list<string> wl_auth_modes = nil;
-global list<string> wl_enc_modes = nil;
-global list<string> wl_channels = nil;
-global list<string> wl_bitrates = nil;
-list<string> nilliststring = nil; // to save some casting
-
-/* s390 options */
-// portname is in ifcfg, others are in hwcfg
-global string portname = "";
-global string chan_mode = "0";
-global string qeth_options = "";
-global boolean ipa_takeover = false;
-// #84148
-// 26bdd00.pdf
-// Ch 7: qeth device driver for OSA-Express (QDIO) and HiperSockets
-// MAC address handling for IPv4 with the layer2 option
-global boolean qeth_layer2 = false;
-global string qeth_macaddress = "00:00:00:00:00:00";
-// Timeout for LCS LANCMD
-global string lcs_timeout = "5";
-
-/* aliases */
-global map aliases = $[];
-
-/* propose options */
-global boolean proposal_valid = false;
-boolean nm_proposal_valid = false;
-boolean write_only = false;
-
-/* current selected HW */
-map hw = $[];
-
-/* NetworkModules:: name */
-global string nm_name = "";
-global string nm_name_old = nil;
/**
* Abort function
@@ -168,14 +73,12 @@
*/
global block<boolean> AbortFunction = nil;
+
+
/*--------------*/
/* PRIVATE DATA */
-/**
- * Hardware information
- * @see ReadHardware
- */
-list<map> Hardware = [];
+
/**
* Modules information
@@ -188,15 +91,7 @@
*/
// FIXME: MOD list<string> DeletedModules = [];
-/**
- * Data was modified?
- */
-boolean modified = false;
-/**
- * Which operation is pending?
- */
-global symbol operation = nil;
// FIXME: used in lan/address.ycp (#17346) -> "global"
@@ -204,48 +99,6 @@
/*------------------*/
/* GLOBAL FUNCTIONS */
-/**
- * Data was modified?
- * @return true if modified
- */
-global define boolean Modified() {
- y2debug("modified=%1",modified);
- return modified;
-}
-
-/**
- * Function which returns if the settings were modified
- * @return boolean settings were modified
- */
-global define boolean GetModified () {
- return modified;
-}
-/**
- * Function sets internal variable, which indicates, that any
- * settings were modified, to "true"
- */
-global define void SetModified () {
- modified = true;
-}
-/**
- * Function sets internal variable, which indicates, that any
- * settings were modified, to "false"
- */
-global define void UnsetModified () {
- modified = false;
-}
-
-
-boolean CheckNetworkManagerPlugin(){
- if (NetworkService::IsManaged()){
- y2milestone("Check what package is needed to configure NetworkManager");
- string nmp = ((string)SCR::Read(.sysconfig.windowmanager.DEFAULT_WM)=="kde")?"NetworkManager-kde":"NetworkManager-gnome";
- y2milestone("Test for %1 if installed", nmp);
- PackageSystem::CheckAndInstallPackages([nmp]);
- }
- return true;
-}
-
// functions for use from autoinstallation
global define boolean isAnyInterfaceDown(){
@@ -269,8 +122,8 @@
y2debug("%1", link_status);
list<string> macs=[];
- foreach(string devs, (list<string>)Map::Keys(autoinstall_settings["devices"]:$[]), {
- foreach(string mac, (list<string>)Map::Keys(autoinstall_settings["devices", devs]:$[]), {
+ foreach(string devs, (list<string>)Map::Keys(LanItems::autoinstall_settings["devices"]:$[]), {
+ foreach(string mac, (list<string>)Map::Keys(LanItems::autoinstall_settings["devices", devs]:$[]), {
list<string> tmp_mac = splitstring(mac, "-");
mac = tmp_mac[size(tmp_mac)-1]:"";
if (!haskey(link_status, mac)) y2error("Mac address %1 not found in map %2!", mac, link_status);
@@ -286,31 +139,11 @@
-/*
- * return list of available modules for device identified by busid
- * with default default_module (on first possition)
- */
-global list<string> getModulesFor(string busid, string default_module){
- if (!hasAnyValue(busid)) return [];
- string bus_id = substring(busid, findfirstof(busid, "0123456789"));
- list<string> mods = [ default_module ];
- foreach(map<string, any> mod_row, (list<map<string, any> >)Hardware, {
- if (mod_row["busid"]:"" == bus_id){
- foreach(map<string, any> row_drv, mod_row["drivers"]:[], {
- foreach(list row , row_drv["modules"]:[], {
- if (row[0]:"" != default_module) mods = add(mods, row[0]:"");
- });
- });
- }
- });
- return mods;
-}
-
-include "network/hardware.ycp";
+//include "network/hardware.ycp";
//include "network/install.ycp";
-include "network/routines.ycp";
-include "network/runtime.ycp";
+//include "network/routines.ycp";
+//include "network/runtime.ycp";
/**
@@ -373,7 +206,7 @@
// Dont read hardware data in config mode
if(!Mode::config ()) {
if(!NetHwDetection::running) NetHwDetection::Start();
- Hardware = ReadHardware("netcard");
+ LanItems::ReadHw();
}
/* ReadHardware(""); /* TESTING */
@@ -383,14 +216,14 @@
/* Progress step 2/9 */
ProgressNextStage(_("Reading /etc/modprobe.conf..."));
// FIXME: MOD // ReadModules(NetworkDevices::CardRegex["netcard"]:"");
- NetworkModules::Read();
+// NetworkModules::Read();
+ LanItems::ReadNetworkModules();
sleep(sl);
if(Abort()) return false;
/* Progress step 3/9 - multiple devices may be present, really plural*/
ProgressNextStage(_("Reading device configuration..."));
- NetworkDevices::Read();
- NetworkDevices::CleanHotplugSymlink();
+ LanItems::ReadNetworkInterfaces();
sleep(sl);
if(Abort()) return false;
@@ -443,7 +276,7 @@
sleep(sl);
if(Abort()) return false;
- modified = false;
+ LanItems::modified = false;
initialized = true;
return true;
}
@@ -459,7 +292,7 @@
global void SetIPv6(boolean status){
if(ipv6 != status) {
ipv6=status;
- SetModified();
+ LanItems::SetModified();
}
}
@@ -484,7 +317,7 @@
if(!write_only && NetHwDetection::running) NetHwDetection::Stop();
/* Stop the detection */
- if(!modified) {
+ if(!LanItems::modified) {
y2milestone("No changes to network setup -> nothing to write");
return true;
}
@@ -643,7 +476,7 @@
NetworkDevices::Import("netcard", (map<string, map>) settings["devices"]:$[]);
NetworkModules::Import("netcard", (map<string, map>) settings["hwcfg"]:$[]);
} else {
- autoinstall_settings = settings;
+ LanItems::autoinstall_settings = settings;
}
NetworkConfig::Import(settings["config"]:$[]);
@@ -652,7 +485,7 @@
NetworkService::SetManaged (settings["managed"]:false);
start_immediately = settings["start_immediately"]:false;
- modified = true;
+ LanItems::modified = true;
return true;
}
@@ -674,65 +507,6 @@
}
/**
- * Select the hardware component
- * @param hw the component
- */
-void SelectHWMap (map hardware) {
- SelectHardwareMap (hardware);
-
- if(hotplug == "") {
- // FIXME: MOD Module["module"] = hw["module"]:"";
- // FIXME: MOD Module["options"] = hw["options"]:"";
- NetworkModules::Alias = hardware["module"]:"";
- NetworkModules::Options = hardware["options"]:"";
- }
- else
- y2milestone("HOTPLUG(%1) -> ignoring modprobe.conf", hotplug);
-
- // Wireless Card Features
- wl_auth_modes = hardware["wl_auth_modes"]:nilliststring;
- wl_enc_modes = hardware["wl_enc_modes"]:nilliststring;
- wl_channels = hardware["wl_channels"]:nilliststring;
- wl_bitrates = hardware["wl_bitrates"]:nilliststring;
-
- string mac = hardware["mac"]:"";
- string busid = hardware["busid"]:"";
-
-
- nm_name = createHwcfgName(hardware);
-
- // name of ifcfg
- /* eth, tr, not on s390 (#38819) */
- if(!Arch::s390 () && mac != nil && mac != "" && mac != "00:00:00:00:00:00")
- device = "id-" + hardware["mac"]:"";
- /* iucv already filled in from lan/hardware.ycp (#42212) */
- else if(type == "iucv")
- y2debug("IUCV: %1", device);
- /* other devs */
- else if(busid != nil && busid != "")
- device = "bus-" + hardware["bus"]:"" + "-" + hardware["busid"]:"";
- /* USB, PCMCIA */
- else if(hardware["hotplug"]:"" != "")
- device = "bus-" + hardware["hotplug"]:"";
- /* dummy */
- else
- y2milestone("No detailed HW info: %1", device);
-
- y2milestone("hw=%1", hardware);
- y2milestone("device=%1", device);
- hw=hardware;
-}
-
-/**
- * Select the hardware component
- * @param which index of the component
- */
-global define void SelectHW(integer which) {
- SelectHWMap (FindHardware (Hardware, which));
-}
-
-
-/**
* Create a textual summary and a list of unconfigured devices
* @param mode "split": split configured and unconfigured?<br />
* "summary": add resolver and routing symmary,
@@ -743,7 +517,7 @@
boolean split = (mode == "split");
- list sum = BuildSummary("netcard", Hardware, split, mode == "proposal");
+ list sum = BuildSummary("netcard", LanItems::Hardware, split, mode == "proposal");
/* Testing improved summary */
if(mode == "summary")
@@ -807,357 +581,18 @@
return [descr, links];
}
-/**
- * Create an overview table with all configured devices
- * @return table items
- */
-global define list Overview() {
- list res = BuildOverview("netcard", Hardware);
- return maplist( term card, (list<term>)res, {
- string id = card[0,0]:"";
- list desc = [ card[1]:"", card[2]:""];
- return $[
- "id":id,
- "rich_descr": card[3]: (desc[1]:_("Unknown")),
- "table_descr":desc
- ];
- }
- );
-}
-global define list<map<string,any> > Unconfigured () {
- return BuildUnconfigured ("netcard", Hardware);
-}
-
-/*-------------------*/
-/* PRIVATE FUNCTIONS */
-
-/**
- * Return 10 free devices
- * @param type device type
- * @return list of 10 free devices
- */
-global define list FreeDevices(string type) {
- return NetworkDevices::GetFreeDevices(type, 10);
-}
-
-/**
- * Return 10 free aliases
- * @param type device type
- * @param num device number
- * @return list of 10 free devices
- */
-global define list FreeAliases(string type, integer num) {
- // FIXME: NI y2debug("Devices=%1", Devices);
- map Devices_1 = $[]; // FIXME: NI Devices[type, sformat("%1",num)]:$[];
- y2debug("Devices=%1", Devices_1);
- return NetworkDevices::GetFreeDevices("_aliases", 10);
-}
-
-
-/**
- * must be in sync with @ref SetDefaultsForHW
- */
-define map GetDefaultsForHW () {
- map ret = $[];
- if (type == "wlan")
- {
- ret = union (
- ret, $[
- "USERCONTROL": "yes", // #63767
- ]);
- }
- // LCS eth interfaces on s390 need the MTU of 1492. #81815.
- // TODO: lcs, or eth?
- // will eth not get mapped to lcs?
- // Apparently both LCS eth and LCS tr are represented as "lcs"
- // but it does not hurt to change the default also for tr
- // #93798: limit to s390 to minimize regressions. Probably it could
- // be also done by only testing for lcs and not eth but that
- // would need more testing.
- else if (Arch::s390 () && contains (["lcs", "eth"], type))
- {
- y2milestone ("Adding LCS: setting MTU");
- ret = add (ret, "MTU", "1492");
- }
- return ret;
-}
-/**
- * must be in sync with @ref GetDefaultsForHW
- */
-global define void SetDefaultsForHW () {
- if (type == "wlan")
- {
- usercontrol = true;
- }
- else if (Arch::s390 () && contains (["lcs", "eth"], type))
- {
- mtu = "1492";
- }
-
- if (!needHwcfg(hw)){
- nm_name_old = nm_name;
- nm_name = "";
- }
- y2milestone("hwcfg name %1", nm_name);
-}
-
-/**
- * the defaults here are what sysconfig defaults to
- * (as opposed to what a new interface gets, in @ref Select)
- */
-map<string, string> SysconfigDefaults = $[
- "BOOTPROTO": "static",
- "IPADDR": "",
- "REMOTE_IPADDR": "",
- "NETMASK": "",
- "MTU": "",
- "ETHTOOL_OPTIONS": "",
- "NAME": "",
- "STARTMODE": "manual",
- "USERCONTROL": "no",
- "WIRELESS_MODE": "Managed",
- "WIRELESS_ESSID": "",
- "WIRELESS_NWID": "",
- "WIRELESS_AUTH_MODE": "open",
- "WIRELESS_WPA_PSK": "",
- "WIRELESS_KEY_LENGTH": "128",
- "WIRELESS_KEY": "",
- "WIRELESS_KEY_0": "",
- "WIRELESS_KEY_1": "",
- "WIRELESS_KEY_2": "",
- "WIRELESS_KEY_3": "",
- "WIRELESS_DEFAULT_KEY": "0",
- "WIRELESS_NICK": "",
- "WIRELESS_WPA_IDENTITY": "",
- "WIRELESS_WPA_PASSWORD": "",
- "WIRELESS_CLIENT_CERT": "",
- "WIRELESS_CA_CERT": "",
- "WIRELESS_CHANNEL": "",
- "WIRELESS_FREQUENCY": "",
- "WIRELESS_BITRATE": "auto",
- "WIRELESS_AP": "",
- "WIRELESS_POWER": "yes",
- "PORTNAME": "",
- // aliases = devmap["_aliases"]:$[]; // ?
- "WIRELESS_EAP_MODE": "",
- "WIRELESS_WPA_IDENTITY": "",
- "WIRELESS_WPA_PASSWORD": "",
- "WIRELESS_WPA_ANONID": "",
- "WIRELESS_CLIENT_CERT": "",
- "WIRELESS_CLIENT_KEY": "",
- "WIRELESS_CLIENT_KEY_PASSWORD": "",
- "WIRELESS_CA_CERT": "",
- "WIRELESS_EAP_AUTH": "",
- "WIRELESS_PEAP_VERSION": "",
-
- "BONDING_MODULE_OPTS": "",
- ];
-
-string GetDeviceVar (map primary, map fallback, string key) {
- string ret = (string) primary[key]:fallback[key]:nil;
- if (ret == nil)
- {
- y2debug ("%1 does not have a default defined", key);
- }
- return ret;
-}
-
-/**
- * Set various device variables
- * @param devmap map with variables
- * @return void
- */
-void SetDeviceVars(map devmap, map defaults) {
- /* address options */
- bootproto = GetDeviceVar (devmap, defaults, "BOOTPROTO");
- ipaddr = GetDeviceVar (devmap, defaults, "IPADDR");
- remoteip = GetDeviceVar (devmap, defaults, "REMOTE_IPADDR");
- netmask = GetDeviceVar (devmap, defaults, "NETMASK");
-
- mtu = GetDeviceVar (devmap, defaults, "MTU");
- ethtool_options = GetDeviceVar (devmap, defaults, "ETHTOOL_OPTIONS");
- startmode = GetDeviceVar (devmap, defaults, "STARTMODE");
- usercontrol = GetDeviceVar (devmap, defaults, "USERCONTROL") == "yes";
- description = GetDeviceVar (devmap, defaults, "NAME");
- bond_option = GetDeviceVar(devmap, defaults, "BONDING_MODULE_OPTS");
-
- bond_slaves=[];
- foreach(any key, any value, devmap,
- {
- if (regexpmatch((string)key, "BONDING_SLAVE[0-9]+"))
- if ((string)value != nil)
- bond_slaves = add(bond_slaves, (string)value);
- });
-
- /* wireless options */
- wl_mode = GetDeviceVar (devmap, defaults, "WIRELESS_MODE");
- wl_essid = GetDeviceVar (devmap, defaults, "WIRELESS_ESSID");
- wl_nwid = GetDeviceVar (devmap, defaults, "WIRELESS_NWID");
- wl_auth_mode = GetDeviceVar (devmap, defaults, "WIRELESS_AUTH_MODE");
- wl_wpa_psk = GetDeviceVar (devmap, defaults, "WIRELESS_WPA_PSK");
- wl_key_length = GetDeviceVar (devmap, defaults, "WIRELESS_KEY_LENGTH");
- wl_key = []; // ensure exactly 4 entries
- wl_key[0] = GetDeviceVar (devmap, defaults, "WIRELESS_KEY_0");
- if (wl_key[0]:"" == "")
- {
- wl_key[0] = GetDeviceVar (devmap, defaults, "WIRELESS_KEY");
- }
- wl_key[1] = GetDeviceVar (devmap, defaults, "WIRELESS_KEY_1");
- wl_key[2] = GetDeviceVar (devmap, defaults, "WIRELESS_KEY_2");
- wl_key[3] = GetDeviceVar (devmap, defaults, "WIRELESS_KEY_3");
-
- wl_default_key = tointeger (GetDeviceVar (devmap, defaults, "WIRELESS_DEFAULT_KEY"));
- wl_nick = GetDeviceVar (devmap, defaults, "WIRELESS_NICK");
-
- wl_wpa_eap = $[];
- wl_wpa_eap["WPA_EAP_MODE"] = GetDeviceVar (devmap, defaults, "WIRELESS_EAP_MODE");
- wl_wpa_eap["WPA_EAP_IDENTITY"] = GetDeviceVar (devmap, defaults, "WIRELESS_WPA_IDENTITY");
- wl_wpa_eap["WPA_EAP_PASSWORD"] = GetDeviceVar (devmap, defaults, "WIRELESS_WPA_PASSWORD");
- wl_wpa_eap["WPA_EAP_ANONID"] = GetDeviceVar (devmap, defaults, "WIRELESS_WPA_ANONID");
- wl_wpa_eap["WPA_EAP_CLIENT_CERT"] = GetDeviceVar (devmap, defaults, "WIRELESS_CLIENT_CERT");
- wl_wpa_eap["WPA_EAP_CLIENT_KEY"] = GetDeviceVar (devmap, defaults, "WIRELESS_CLIENT_KEY");
- wl_wpa_eap["WPA_EAP_CLIENT_KEY_PASSWORD"] = GetDeviceVar (devmap, defaults, "WIRELESS_CLIENT_KEY_PASSWORD");
- wl_wpa_eap["WPA_EAP_CA_CERT"] = GetDeviceVar (devmap, defaults, "WIRELESS_CA_CERT");
- wl_wpa_eap["WPA_EAP_AUTH"] = GetDeviceVar (devmap, defaults, "WIRELESS_EAP_AUTH");
- wl_wpa_eap["WPA_EAP_PEAP_VERSION"] = GetDeviceVar (devmap, defaults, "WIRELESS_PEAP_VERSION");
-
- wl_channel = GetDeviceVar (devmap, defaults, "WIRELESS_CHANNEL");
- wl_frequency = GetDeviceVar (devmap, defaults, "WIRELESS_FREQUENCY");
- wl_bitrate = GetDeviceVar (devmap, defaults, "WIRELESS_BITRATE");
- wl_accesspoint = GetDeviceVar (devmap, defaults, "WIRELESS_AP");
- wl_power = GetDeviceVar (devmap, defaults, "WIRELESS_POWER") == "yes";
-
- /* s/390 options */
- portname = GetDeviceVar (devmap, defaults, "PORTNAME");
-
- aliases = devmap["_aliases"]:$[];
-
- return;
-}
-
-/**
- * Select the given device
- * @param dev device to select ("" for new device, default values)
- * @return true if success
- */
-global define boolean Select(string dev) {
- y2debug("dev=%1", dev);
- map devmap = $[];
- /* dev=="" -> Add */
- if(dev == "") {
- // defaults for a new device
- devmap = $[
- "STARTMODE": "auto", // #115448, #156388
- "NETMASK": (NetHwDetection::result["NETMASK"]:"255.255.255.0"), // #31369
- ];
- string product_startmode = ProductFeatures::GetStringFeature ("network", "startmode");
- if (contains (["auto", "ifplugd"], product_startmode))
- {
- y2milestone ("Product startmode: %1", product_startmode);
- if (product_startmode == "ifplugd" && ! Arch::is_laptop ())
- {
- // #164816
- y2milestone ("Not a laptop, will not prefer ifplugd");
- product_startmode = "auto";
- }
- devmap["STARTMODE"] = product_startmode;
- }
-
- type = "eth";
- device = NetworkDevices::GetFreeDevice(type);
-
- // FIXME: MOD AddModule(type);
- NetworkModules::AddM();
- nm_name = NetworkModules::GetFreeName("static-");
-
- /* FIXME: alias: how to prefill new alias? */
- alias = "";
- }
- /* dev!="" -> Edit */
- else {
- /* FIXME: NI:
- if(!CheckDevice(dev)) {
- y2error("Device not found: %1", dev);
- return false;
- }
- */
- NetworkDevices::Edit(dev);
- devmap = NetworkDevices::Current;
- type = NetworkDevices::device_type(dev);
- device = NetworkDevices::device_num(dev);
- alias = NetworkDevices::alias_num(dev);
- nm_name = devmap["_nm_name"]:"";
- }
-
- /* general stuff */
- description = BuildDescription (type, device, devmap, Hardware);
-
- unique = devmap["udi"]:"";
- SetDeviceVars(devmap, SysconfigDefaults);
-
-
- hotplug = "";
- /*
- if(issubstring(device, "bus-pcmcia"))
- hotplug = "pcmcia";
- else if(issubstring(device, "bus-usb"))
- hotplug = "usb";
- */
-
- y2debug("type=%1", type);
- if(issubstring(type, "-"))
- type = regexpsub(type, "([^-]+)-.*$", "\\1");
- y2debug("type=%1", type);
-
- /* kernel options */
- if(hotplug == "" && alias == "" && nm_name != "") {
- // FIXME: MOD SelectModule(dev);
- NetworkModules::SelectM(nm_name);
- }
- else {
- // FIXME: MOD SelectModule("");
- NetworkModules::AddM();
- }
-
- qeth_options = NetworkModules::QETH_OPTIONS;
- chan_mode = NetworkModules::CCW_CHAN_MODE;
- lcs_timeout = NetworkModules::LCS_LANCMD_TIMEOUT;
-
- if (NetworkModules::QETH_IPA_TAKEOVER == nil ||
- NetworkModules::QETH_IPA_TAKEOVER == "" ||
- NetworkModules::QETH_IPA_TAKEOVER == "0")
- ipa_takeover = false;
- else
- ipa_takeover = true;
-
- if (NetworkModules::QETH_LAYER2_SUPPORT == nil ||
- NetworkModules::QETH_LAYER2_SUPPORT == "" ||
- NetworkModules::QETH_LAYER2_SUPPORT == "0")
- qeth_layer2 = false;
- else
- qeth_layer2 = true;
-
- /* We always have to set the MAC Address for qeth Layer2 support */
- if (qeth_layer2 ) {
- qeth_macaddress = devmap["LLADDR"]:"00:00:00:00:00:00";
- }
-
- //if(bootproto == "none") bootproto = "static";
-
- return true;
-}
/**
* Add a new device
* @return true if success
*/
global define boolean Add() {
- operation = nil;
- if(Select("") != true) return false;
+ LanItems::operation = nil;
+ if(LanItems::Select("") != true) return false;
NetworkDevices::Add();
- operation = `add;
+ LanItems::operation = `add;
return true;
}
@@ -1167,10 +602,11 @@
* @return true if success
*/
global define boolean Edit(string name) {
- operation = nil;
- if(Select(name) != true) return false;
+ LanItems::operation = nil;
+ if(LanItems::Select(name) != true) return false;
NetworkDevices::Edit(name);
- operation = `edit;
+ LanItems::operation = `edit;
+ LanItems::interfacename = NetworkDevices::Name;
return true;
}
@@ -1179,420 +615,15 @@
* @param name device to delete
* @return true if success
*/
-global define boolean Delete(string name) {
+global define boolean Delete() {
+ LanItems::DeleteItem();
+/*
operation = nil;
if(Select(name) != true) return false;
NetworkDevices::Delete(name);
operation = `delete;
- return true;
-}
-
-// ifplugd sometimes does not work for wifi
-// so wired needs higher priority to override it
-map <string, string> ifplugd_priorities = $[
- "eth": "20",
- "wlan": "10",
- ];
-
-/**
- * Commit pending operation
- * @return true if success
- */
-global define boolean Commit() {
- y2debug("Commit(%1)", operation);
-
- if(operation == `add || operation == `edit) {
- map<string,any> newdev = $[];
-
- // #104494 - always write IPADDR+NETMASK, even empty
- newdev["IPADDR"] = ipaddr;
- newdev["NETMASK"] = netmask;
- // #50955 omit computable fields
- newdev["BROADCAST"] = "";
- newdev["NETWORK"] = "";
-
- newdev["REMOTE_IPADDR"] = remoteip;
-
- if(alias == "") {
- newdev["MTU"] = mtu;
- newdev["ETHTOOL_OPTIONS"] = ethtool_options;
- newdev["STARTMODE"] = startmode;
- // it is not in Select yet because we don't have a widget for it
- if (startmode == "ifplugd")
- {
- string prio = ifplugd_priorities[type]:"";
- newdev["IFPLUGD_PRIORITY"] = prio;
- }
- newdev["USERCONTROL"] = usercontrol? "yes": "no";
- newdev["BOOTPROTO"] = bootproto;
- newdev["NAME"] = description;
- }
-
- if(unique != "" && unique != nil)
- newdev["udi"] = unique;
-
- if(hotplug == "") {
- if(alias == "") {
- // FIXME: MOD ChangeModule(NetworkDevices::device_name(type, device), operation == `add);
- y2milestone("HWCFG name %1 (%2)", nm_name, nm_name_old);
- if(nm_name != nil && nm_name != "" && operation == `edit &&
- nm_name_old != nil && nm_name_old != "" &&
- nm_name != nm_name_old) {
- y2milestone("HWCFG name change (%1) -> deleting old (%2)", nm_name, nm_name_old);
- NetworkModules::DeleteM(nm_name_old);
- nm_name_old = nil;
- }
-
- if(Arch::s390 ()) {
- string type2 = DriverType (type);
- if(type2 == "iucv") {
- NetworkModules::SCRIPTUP = "hwup-iucv";
- }
- else {
- NetworkModules::SCRIPTUP = "hwup-ccw";
- NetworkModules::SCRIPTUP_ccw = "hwup-ccw";
- NetworkModules::SCRIPTDOWN = "hwdown-ccw";
- NetworkModules::SCRIPTUP_ccwgroup = "hwup-" + type2;
- }
-
- integer devid = 0;
- string devstr = "";
-
- y2milestone("nm_name=%1", nm_name);
- string s390chanid = "[0-9]+\\.[0-9]+\\.";
- if(regexpmatch(nm_name, s390chanid)) {
- devid = tointeger("0x" + regexpsub(nm_name, s390chanid + "(.*)", "\\1"));
- devstr = regexpsub(nm_name, ".*[^0-9](" + s390chanid + ").*", "\\1");
- }
-
- y2milestone("devid=%1(%2)", devid, devstr);
- if(devid == nil) devid = 0;
- string devid0 = String::PadZeros(regexpsub(tohexstring(devid), "0x(.*)", "\\1"), 4);
- string devid1 = String::PadZeros(regexpsub(tohexstring(devid+1), "0x(.*)", "\\1"), 4);
- string devid2 = String::PadZeros(regexpsub(tohexstring(devid+2), "0x(.*)", "\\1"), 4);
-
- if(type2 == "ctc" || type2 == "lcs") {
- NetworkModules::CCW_CHAN_IDS = sformat("%1%2 %1%3", devstr, devid0, devid1);
- NetworkModules::CCW_CHAN_MODE = chan_mode;
- NetworkModules::CCW_CHAN_NUM = "2";
- NetworkModules::LCS_LANCMD_TIMEOUT = lcs_timeout;
- }
- else if(type2 == "qeth") {
- NetworkModules::CCW_CHAN_IDS = sformat("%1%2 %1%3 %1%4", devstr, devid0, devid1, devid2);
- NetworkModules::CCW_CHAN_MODE = chan_mode;
- NetworkModules::CCW_CHAN_NUM = "3";
- NetworkModules::QETH_OPTIONS = qeth_options;
- NetworkModules::QETH_IPA_TAKEOVER = ipa_takeover? "1": "0";
- NetworkModules::QETH_LAYER2_SUPPORT = qeth_layer2? "1": "0";
- if (qeth_layer2 && qeth_macaddress != "00:00:00:00:00:00") {
- newdev["LLADDR"] = qeth_macaddress;
- }
- else {
- // #151196: layer 3 otherwise fails
- newdev["LLADDR"] = "";
- }
- }
-
- }
-
- // If "", no hwcfg is created. See also #42421.
- NetworkModules::ChangeM(nm_name);
- }
- }
-
- if(hotplug == "pcmcia")
- newdev["DHCLIENT_SET_DOWN_LINK"] = "yes";
-
-
- if (type == "bond")
- {
- integer i = 0;
- foreach (string slave, bond_slaves,
- {
- newdev[sformat("BONDING_SLAVE%1", i)] = slave;
- i = i + 1;
- });
-
- //assign nil to rest BONDING_SLAVEn to remove them
- while (i<10)
- {
- newdev[sformat("BONDING_SLAVE%1", i)] = nil;
- i = i + 1;
- };
-
- newdev["BONDING_MODULE_OPTS"] = bond_option;
-
- //BONDING_MASTER always is yes
- newdev["BONDING_MASTER"] = "yes";
- }
-
- if(type == "wlan") {
- newdev["WIRELESS_MODE"] = wl_mode;
- newdev["WIRELESS_ESSID"] = wl_essid;
- newdev["WIRELESS_NWID"] = wl_nwid;
- newdev["WIRELESS_AUTH_MODE"] = wl_auth_mode;
- newdev["WIRELESS_WPA_PSK"] = wl_wpa_psk;
- newdev["WIRELESS_KEY_LENGTH"] = wl_key_length;
- // obsoleted by WIRELESS_KEY_0
- newdev["WIRELESS_KEY"] = ""; // TODO: delete the varlable
- newdev["WIRELESS_KEY_0"] = wl_key[0]:"";
- newdev["WIRELESS_KEY_1"] = wl_key[1]:"";
- newdev["WIRELESS_KEY_2"] = wl_key[2]:"";
- newdev["WIRELESS_KEY_3"] = wl_key[3]:"";
- newdev["WIRELESS_DEFAULT_KEY"] = tostring (wl_default_key);
- newdev["WIRELESS_NICK"] = wl_nick;
-
- if (wl_wpa_eap != $[])
- {
- newdev["WIRELESS_EAP_MODE"] = wl_wpa_eap["WPA_EAP_MODE"]:"";
- newdev["WIRELESS_WPA_IDENTITY"] = wl_wpa_eap["WPA_EAP_IDENTITY"]:"";
- newdev["WIRELESS_WPA_PASSWORD"] = wl_wpa_eap["WPA_EAP_PASSWORD"]:"";
- newdev["WIRELESS_WPA_ANONID"] = wl_wpa_eap["WPA_EAP_ANONID"]:"";
- newdev["WIRELESS_CLIENT_CERT"] = wl_wpa_eap["WPA_EAP_CLIENT_CERT"]:"";
- newdev["WIRELESS_CLIENT_KEY"] = wl_wpa_eap["WPA_EAP_CLIENT_KEY"]:"";
- newdev["WIRELESS_CLIENT_KEY_PASSWORD"] = wl_wpa_eap["WPA_EAP_CLIENT_KEY_PASSWORD"]:"";
- newdev["WIRELESS_CA_CERT"] = wl_wpa_eap["WPA_EAP_CA_CERT"]:"";
- newdev["WIRELESS_EAP_AUTH"] = wl_wpa_eap["WPA_EAP_AUTH"]:"";
- newdev["WIRELESS_PEAP_VERSION"] = wl_wpa_eap["WPA_EAP_PEAP_VERSION"]:"";
- }
-
- newdev["WIRELESS_CHANNEL"] = wl_channel;
- newdev["WIRELESS_FREQUENCY"] = wl_frequency;
- newdev["WIRELESS_BITRATE"] = wl_bitrate;
- newdev["WIRELESS_AP"] = wl_accesspoint;
- newdev["WIRELESS_POWER"] = wl_power ? "yes" : "no";
- }
-
- if(nm_name != nil && nm_name != "")
- newdev["_nm_name"] = nm_name;
-
- if(DriverType (type) == "ctc")
- if(NetworkConfig::Config["WAIT_FOR_INTERFACES"]:nil == nil || NetworkConfig::Config["WAIT_FOR_INTERFACES"]:0 < 40)
- NetworkConfig::Config["WAIT_FOR_INTERFACES"] = 40;
-
- /* FIXME: MOD
- if(DriverType (type) == "qeth")
- if(NetworkConfig::Config["WAIT_FOR_INTERFACES"]:nil == nil || NetworkConfig::Config["WAIT_FOR_INTERFACES"]:0 < 15)
- NetworkConfig::Config["WAIT_FOR_INTERFACES"] = 15;
- */
-
- if(alias == "") {
- newdev["_aliases"] = aliases;
- y2milestone("aliases %1", aliases);
- NetworkDevices::Name = NetworkDevices::device_name(NetworkDevices::RealType(type, hotplug), device);
- }
- else
- NetworkDevices::Name = NetworkDevices::alias_name(NetworkDevices::RealType(type, hotplug), device, alias);
- NetworkDevices::Current = newdev;
- NetworkDevices::Commit();
- }
- else if(operation == `delete) {
- NetworkDevices::Commit();
- if(alias == "") {
- if(hotplug == "") {
- // FIXME: MOD DeleteModule(NetworkDevices::device_name(type, device));
- NetworkModules::DeleteM(nm_name);
- // FIXME: NI DeleteDevice2(NetworkDevices::device_name(type, device));
- }
- // #145001
- /*
- NetworkUdev::Delete (device);
- HwStatus::...
- */
- }
- else {
- // FIXME: NI DeleteDevice2(NetworkDevices::device_name(type, device) + ":" + alias);
- }
- }
- else {
- y2error("Unknown operation: %1", operation);
- return false;
- }
-
- nm_name_old = nil;
- modified = true;
- operation = nil;
- return true;
-}
-
-/**
- * Get the module configuration for the modules configured in the
- * interface section
- * @param ay_device Device, for example eth0
- * @param ay_modules list of modules from the AY profile
- * @return map the module map with module name and options
- */
-define map GetModuleForInterface(string ay_device ,
- list<map> ay_modules) {
- map ayret = $[];
- list<map> ay_filtered = filter(map ay_m, ay_modules,
- ``(
- ay_m["device"]:"" == ay_device ));
-
- if (size(ay_filtered) > 0 ) {
- ayret = ay_filtered[0]:$[];
- }
-
- return ayret;
-}
-
-
-/**
- * Find matching device
- * Find a device, optionally with some predefined values
- * @param interface interface map
- * @return map The map of the matching device.
- */
-define map FindMatchingDevice(map interface) {
- map tosel = nil;
- // Minimal changes to code to fix both #119592 and #146965
- // Alternatively we could try to ensure that we never match a
- // device that got already matched
- boolean matched_by_module = false;
-
- list<string> devs = NetworkDevices::List("netcard");
- y2milestone("Configured devices: %1", devs );
-
- // this condition is always true for SLES9, HEAD uses $[] for proposal
- if (interface != $[])
- {
- // Notes for comments about matching:
- // - interface["device"] is the key which we look for in the actual hw
- // - H iterates over Hardware
- // - patterns are shell-like
-
- list device_id = splitstring(interface["device"]:"", "-");
- /* code for eth-id-00:80:c8:f6:48:4c configurations */
- // *-id-$ID => find H["mac"] == $ID
- if (size(device_id)> 1 && device_id[1]:"" == "id")
- {
- string hwaddr = device_id[2]:"";
- if(hwaddr != nil && hwaddr != "") {
- tosel = find (map h, Hardware, ``( h["mac"]:"" == hwaddr ));
- }
- y2milestone("Rule: matching mac in device name");
- }
- /* code for eth-bus-pci-0000:00:0d.0 configurations */
- /* code for eth-bus-vio-30000001 configurations */
- // *-bus-$BUS-$ID => find H["bus"] == $BUS & H["busid"] == $ID
- else if (size(device_id)> 2 && device_id[1]:"" == "bus")
- {
- string bus = device_id[2]:"";
- string busid = device_id[3]:"";
- if(bus != nil && bus != "" && busid != nil && busid != "") {
- tosel = find (map h, Hardware, ``( h["busid"]:"" == busid
- && h["bus"]:"" == bus ));
- }
- y2milestone("Rule: matching bus id in device name");
- }
-
- /* code for module configuration */
- // join with the modules list of the ay profile according to "device"
- // if exists => find H["module"] == AH["module"]
- map aymodule = GetModuleForInterface(interface["device"]:"",
- autoinstall_settings["modules"]:[]);
- y2milestone("module data: %1", aymodule );
- if (tosel == nil && aymodule != $[]) {
- if(aymodule != nil && aymodule["module"]:"" != "") {
- tosel = find (map h, Hardware, ``( h["module"]:"" == aymodule["module"]:"" ));
- }
- if (tosel != nil)
- {
- matched_by_module = true;
- }
- y2milestone("Rule: matching module configuration");
- }
- }
-
- // First device was already configured, we are now looking for
- // a second (third,...) one
- if (size(devs) > 0 )
- {
- // #119592, #146965: this used to be unconditional, overwriting the
- // results of the above matching.
- if (matched_by_module || tosel == nil)
- {
- // go thru all devices, check whether there's one that does
- // not have a configuration yet
- // and has the same type as the current profile item
- foreach (map h, Hardware, {
- y2milestone("Checking for device=%1", h);
- SelectHWMap(h);
- string _device_name = NetworkDevices::device_name(NetworkDevices::RealType(type, hotplug), device);
- if (!NetworkDevices::Check(_device_name) &&
- type == NetworkDevices::device_type(interface["device"]:"")
- )
- {
- y2milestone("Selected: %1", h );
- tosel = h;
- break;
- }
- });
- }
- if (tosel == nil )
- {
- y2error("Nothing found");
- }
-
- } else {
- // this is the first interface, match the hardware with install.inf
-/*
- // couldn't happen
- if (size(InstallInf)>0){
- // Select the one from install.inf with the same MAC
- // find H["mac"] == InstallInf["hwaddr"]
- if (tosel == nil ) {
- string hwaddr = InstallInf["hwaddr"]:"";
- if(hwaddr != nil && hwaddr != "") {
- tosel = find (map h, Hardware, ``( h["mac"]:"" == hwaddr ));
- }
- y2milestone("Rule: matching hwaddr in install.inf");
- }
-
- // Select the one from install.inf with the same module
- // find H["module"] == InstallInf["module"]
- if (tosel == nil) {
- string infmodule = InstallInf["module"]:"";
- if(infmodule != nil && infmodule != "") {
- tosel = find (map h, Hardware, ``( h["module"]:"" == infmodule ));
- }
- y2milestone("Rule: matching module in install.inf");
- }
- } else
*/
- {
- /* No install.inf -> select the first connected */
- // find H["active"] == true
- if (tosel == nil) {
- tosel = find (map h, Hardware, ``(
- h["link", "state"]:false
- ));
- y2milestone("Rule: first connected");
- }
- }
-
- /* No install.inf driver -> select the first active */
- // find H["active"] == true
- if (tosel == nil) {
- tosel = find (map h, Hardware, ``(
- h["active"]:false
- ));
- y2milestone("Rule: first active");
- }
-
- /* No active driver -> select the first with a driver */
- // find H["module"] != ""
- if (tosel == nil) {
- y2milestone("No active driver found, trying further.");
- tosel = find (map h, Hardware, ``(
- h["module"]:"" != ""
- && y2milestone("Using driver: %1", h) == nil
- ));
- y2milestone("Rule: first with driver");
- }
- }
-
- return tosel;
+ return true;
}
@@ -1635,16 +666,16 @@
*/
define void ProposeNMInterfaces () {
y2milestone ("Minimal ifcfgs for NM");
- foreach (map hwitem, Hardware, {
+ foreach (map hwitem, LanItems::Hardware, {
Add ();
- SelectHWMap (hwitem);
- SetDefaultsForHW ();
- ipaddr = "";
- bootproto = "dhcp";
+ LanItems::SelectHWMap (hwitem);
+ LanItems::SetDefaultsForHW ();
+ LanItems::ipaddr = "";
+ LanItems::bootproto = "dhcp";
// will say "Device already present" for existing because of Add,
// which is what we want
- Commit ();
+ LanItems::Commit ();
});
}
@@ -1654,23 +685,23 @@
*/
global define boolean ProposeInterfaces () {
- y2milestone("Hardware=%1", Hardware);
+ y2milestone("Hardware=%1", LanItems::Hardware);
// y2milestone("InstallInf=%1", InstallInf);
y2milestone("NetworkConfig::Config=%1", NetworkConfig::Config);
y2milestone("NetworkConfig::DHCP=%1", NetworkConfig::DHCP);
- if (! nm_proposal_valid)
+ if (! LanItems::nm_proposal_valid)
{
NetworkService::SetManaged (UseNetworkManager ());
- nm_proposal_valid = true;
+ LanItems::nm_proposal_valid = true;
}
if (NetworkService::IsManaged ())
{
ProposeNMInterfaces ();
- modified = true; // #144139 workaround
+ LanItems::modified = true; // #144139 workaround
y2milestone ("NM proposal");
return true;
}
@@ -1688,17 +719,17 @@
map tosel = nil;
/* Some HW found -> use it for proposal */
- if(size(Hardware) > 0) {
+ if(size(LanItems::Hardware) > 0) {
// if (Arch::s390()){
// tosel = FindMatchingDevice( $["device":sformat("%1-id-%2",InstallInf["module"]:"", InstallInf["hwaddr"]:"")] );
// }
// else
- tosel = FindMatchingDevice($[]);
+ tosel = LanItems::FindMatchingDevice($[]);
}
- y2debug("Hardware=%1", Hardware);
+ y2debug("Hardware=%1", LanItems::Hardware);
y2milestone ("Selected HW w/o install.inf patches: %1", tosel);
/*
@@ -1769,7 +800,7 @@
// This is proposal. also need to do it with
// - add from ui: detected and undetected
// - autoyast
- SetDefaultsForHW ();
+ LanItems::SetDefaultsForHW ();
// #145041
// ethtool_options = InstallInf["ethtool_options"]:"";
@@ -1777,21 +808,21 @@
// #176804
if (NetworkStorage::isDiskOnNetwork ( NetworkStorage::getDevice("/") ))
{
- startmode = "nfsroot";
+ LanItems::startmode = "nfsroot";
y2milestone ("startmode nfsroot");
}
// ipaddr = InstallInf["ipaddr"]:"";
// bootproto = InstallInf["bootproto"]:"static";
- y2debug("ipaddr,bootproto=%1,%2", ipaddr, bootproto);
- if(bootproto == "static" && ipaddr != "" && ipaddr != nil) {
+ y2debug("ipaddr,bootproto=%1,%2", LanItems::ipaddr, LanItems::bootproto);
+ if(LanItems::bootproto == "static" && LanItems::ipaddr != "" && LanItems::ipaddr != nil) {
y2milestone("static proposal");
/* propose address setup from /etc/install.inf */
// netmask = InstallInf["netmask"]:"";
- if(netmask == nil || netmask == "")
- netmask = "255.255.255.0";
+ if(LanItems::netmask == nil || LanItems::netmask == "")
+ LanItems::netmask = "255.255.255.0";
}
else {
/* Propose static config in case of DSL hardware is found */
@@ -1801,8 +832,8 @@
y2milestone ("pppoe=%1", pppoe);
if(pppoe != nil && size(pppoe) > 0) {
y2milestone("DSL proposal");
- ipaddr = "";
- bootproto = "static";
+ LanItems::ipaddr = "";
+ LanItems::bootproto = "static";
}
else {
// Open Enterprise Server does not like DHCP (#50524).
@@ -1813,12 +844,12 @@
return false;
}
y2milestone("DHCP proposal");
- ipaddr = "";
- bootproto = "dhcp";
+ LanItems::ipaddr = "";
+ LanItems::bootproto = "dhcp";
}
}
- Commit();
+ LanItems::Commit();
y2milestone("NetworkConfig::Config=%1", NetworkConfig::Config);
y2milestone("NetworkConfig::DHCP=%1", NetworkConfig::DHCP);
@@ -1870,7 +901,7 @@
* @return true if something was proposed
*/
global define boolean ProposeRoutesAndResolver () {
- if(bootproto == "static" && ipaddr != "" && ipaddr != nil) {
+ if(LanItems::bootproto == "static" && LanItems::ipaddr != "" && LanItems::ipaddr != nil) {
/* propose default gateway from /etc/install.inf */
// Routing::ReadFromGateway (InstallInf["gateway"]:"");
@@ -1897,14 +928,14 @@
*/
global define boolean Autoinstall() {
- y2milestone("Hardware=%1", Hardware);
+ y2milestone("Hardware=%1", LanItems::Hardware);
map tosel = nil;
/* Some HW found -> use it for proposal */
- if(size(Hardware) > 0
- && size(autoinstall_settings["interfaces"]:[]) > 0) {
+ if(size(LanItems::Hardware) > 0
+ && size(LanItems::autoinstall_settings["interfaces"]:[]) > 0) {
- foreach(map<string, string> interface, autoinstall_settings["interfaces"]:[], ``{
+ foreach(map<string, string> interface, LanItems::autoinstall_settings["interfaces"]:[], ``{
list<string> devs = NetworkDevices::List("netcard");
y2milestone("devs: %1", devs);
@@ -1912,13 +943,13 @@
Add();
- tosel = FindMatchingDevice(interface);
+ tosel = LanItems::FindMatchingDevice(interface);
y2milestone("tosel=%1", tosel);
// Read module data from autoyast
- map aymodule = GetModuleForInterface(interface["device"]:"",
- autoinstall_settings["modules"]:[]);
+ map aymodule = LanItems::GetModuleForInterface(interface["device"]:"",
+ LanItems::autoinstall_settings["modules"]:[]);
if (tosel != nil)
@@ -1928,7 +959,7 @@
tosel["options"] = (aymodule["options"]:""!= "")?
aymodule["options"]:"" : tosel["options"]:"";
- SelectHWMap(tosel);
+ LanItems::SelectHWMap(tosel);
}
/* Nothing detected -> use InstallInf */
/*
@@ -1960,22 +991,22 @@
});
- map defaults = union (SysconfigDefaults, GetDefaultsForHW ());
+ map defaults = union (LanItems::SysconfigDefaults, LanItems::GetDefaultsForHW ());
// Set interface variables
- SetDeviceVars(interface, defaults);
+ LanItems::SetDeviceVars(interface, defaults);
- y2debug("ipaddr,bootproto=%1,%2", ipaddr, bootproto);
- if(bootproto == "static" && ipaddr != "" && ipaddr != nil)
+ y2debug("ipaddr,bootproto=%1,%2", LanItems::ipaddr, LanItems::bootproto);
+ if(LanItems::bootproto == "static" && LanItems::ipaddr != "" && LanItems::ipaddr != nil)
{
y2milestone("static configuration");
- if(netmask == nil || netmask == "")
- netmask = "255.255.255.0";
+ if(LanItems::netmask == nil || LanItems::netmask == "")
+ LanItems::netmask = "255.255.255.0";
}
- Commit();
+ LanItems::Commit();
});
}
else
@@ -1986,17 +1017,17 @@
// #153426 - using ProposeInterfaces instead of Propose omitted these
// if they are nonempty, Import has already taken care of them.
- if (autoinstall_settings["routing", "routes"]:[] == [])
+ if (LanItems::autoinstall_settings["routing", "routes"]:[] == [])
{
y2milestone ("gateway from install.inf");
// Routing::ReadFromGateway (InstallInf["gateway"]:"");
}
- if (autoinstall_settings["dns", "nameservers"]:[] == [])
+ if (LanItems::autoinstall_settings["dns", "nameservers"]:[] == [])
{
y2milestone ("nameserver from install.inf");
// DNS::ReadNameserver (InstallInf["nameserver"]:"");
}
- if (autoinstall_settings["dns", "hostname"]:"" == "")
+ if (LanItems::autoinstall_settings["dns", "hostname"]:"" == "")
{
ProposeHostname ();
}
@@ -2013,20 +1044,12 @@
return size(union(NetworkDevices::Locate("BOOTPROTO", "dhcp"), NetworkDevices::Locate("BOOTPROTO", "dhcp+autoip"))) > 0;
}
-/**
- * Check if the given device has any virtual alias.
- * @param dev device to be checked
- * @return true if there are some aliases
- */
-global define boolean HasAliases(string dev) {
- return NetworkDevices::HasAliases(dev);
-}
global define list<map> PrepareForAutoinst() {
// ReadInstallInf();
- Hardware = ReadHardware("netcard");
- return Hardware;
+ LanItems::ReadHw();
+ return LanItems::Hardware;
}
/**
Added: trunk/network/src/modules/LanItems.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/modules/LanItems.ycp…
==============================================================================
--- trunk/network/src/modules/LanItems.ycp (added)
+++ trunk/network/src/modules/LanItems.ycp Mon Jul 2 16:53:49 2007
@@ -0,0 +1,1199 @@
+{
+
+module "LanItems";
+textdomain "network";
+
+import "NetworkDevices";
+import "ProductFeatures";
+import "NetworkConfig";
+include "network/complex.ycp";
+include "network/routines.ycp";
+
+/**
+ * Hardware information
+ * @see ReadHardware
+ */
+global map<integer, any> Items = $[];
+global list<map> Hardware = [];
+global map <string, any> udev_rules = $[];
+
+global string interfacename="";
+
+// used at autoinstallation time
+global map autoinstall_settings = $[];
+
+/**
+ * Data was modified?
+ */
+global boolean modified = false;
+/* current selected HW */
+map hw = $[];
+
+/**
+ * Which operation is pending?
+ */
+global symbol operation = nil;
+
+
+
+global string description = "";
+global string unique = "";
+
+global string type = "";
+global string device = "";
+global string alias = "";
+global integer current = -1;
+global string hotplug = "";
+
+global list<string> Requires = [];
+
+/* address options */
+/** boot protocol: BOOTPROTO */
+global string bootproto = "static";
+global string ipaddr = "";
+global string remoteip = "";
+global string netmask = "";
+
+global string startmode = "auto";
+global boolean usercontrol = false;
+global string mtu = "";
+global string ethtool_options = "";
+
+/* wireless options */
+global string wl_mode = "";
+global string wl_essid = "";
+global string wl_nwid = "";
+global string wl_auth_mode = "";
+// when adding another key, don't forget the chmod 600 in NetworkDevices
+global string wl_wpa_psk = "";
+global string wl_key_length = "";
+global list<string> wl_key = [];
+global integer wl_default_key = 0;
+global string wl_nick = "";
+
+//bond options
+global list<string> bond_slaves = [];
+global string bond_option="";
+/**
+ * wl_wpa_eap aggregates the settings in a map for easier CWM access.
+ * @struct wpa_eap
+ * WPA_EAP_MODE: string ("TTLS" "PEAP" or "TLS")
+ * WPA_EAP_IDENTITY: string
+ * WPA_EAP_PASSWORD: string (for TTLS and PEAP)
+ * WPA_EAP_ANONID: string (for TTLS and PEAP)
+ * WPA_EAP_CLIENT_CERT: string (for TLS, file name)
+ * WPA_EAP_CLIENT_KEY: string (for TLS, file name)
+ * WPA_EAP_CLIENT_KEY_PASSWORD: string (for TLS)
+ * WPA_EAP_CA_CERT: string (file name)
+ * WPA_EAP_AUTH: string ("", "MD5", "GTC", "CHAP"*, "PAP"*, "MSCHAP"*, "MSCHAPV2") (*: TTLS only)
+ * WPA_EAP_PEAP_VERSION: string ("", "0", "1")
+ */
+global map<string, any> wl_wpa_eap = $[];
+global string wl_channel = "";
+global string wl_frequency = "";
+global string wl_bitrate = "";
+global string wl_accesspoint = "";
+global boolean wl_power = true;
+
+// Card Features from hwinfo
+// if not provided, we use the default full list
+global list<string> wl_auth_modes = nil;
+global list<string> wl_enc_modes = nil;
+global list<string> wl_channels = nil;
+global list<string> wl_bitrates = nil;
+list<string> nilliststring = nil; // to save some casting
+
+/* s390 options */
+// portname is in ifcfg, others are in hwcfg
+global string portname = "";
+global string chan_mode = "0";
+global string qeth_options = "";
+global boolean ipa_takeover = false;
+// #84148
+// 26bdd00.pdf
+// Ch 7: qeth device driver for OSA-Express (QDIO) and HiperSockets
+// MAC address handling for IPv4 with the layer2 option
+global boolean qeth_layer2 = false;
+global string qeth_macaddress = "00:00:00:00:00:00";
+// Timeout for LCS LANCMD
+global string lcs_timeout = "5";
+
+/* aliases */
+global map aliases = $[];
+
+/* propose options */
+global boolean proposal_valid = false;
+global boolean nm_proposal_valid = false;
+
+/* NetworkModules:: name */
+global string nm_name = "";
+global string nm_name_old = nil;
+
+include "network/hardware.ycp";
+
+map <string, any> ReadUdevRules(){
+ udev_rules = (map<string, any>)SCR::Read(.udev_persistent);
+ return udev_rules;
+}
+
+void WriteUdevRules(){
+ SCR::Write(.udev_persistent, udev_rules);
+}
+
+/**
+ * Data was modified?
+ * @return true if modified
+ */
+global define boolean Modified() {
+ y2debug("modified=%1",modified);
+ return modified;
+}
+
+/**
+ * Function which returns if the settings were modified
+ * @return boolean settings were modified
+ */
+global define boolean GetModified () {
+ return modified;
+}
+/**
+ * Function sets internal variable, which indicates, that any
+ * settings were modified, to "true"
+ */
+global define void SetModified () {
+ modified = true;
+}
+/**
+ * Function sets internal variable, which indicates, that any
+ * settings were modified, to "false"
+ */
+global define void UnsetModified () {
+ modified = false;
+}
+
+
+/*
+ * return list of available modules for current device
+ * with default default_module (on first possition)
+ */
+
+global list<string> GetItemModules(string default_module){
+ list<string> mods = [];
+ if (hasAnyValue(default_module)) mods = add(mods, default_module);
+ foreach(map row, Items[current, "hwinfo", "drivers"]:[], {
+ string tmp_mod = row["modules", 0, 0]:"";
+ if (!contains(mods, tmp_mod)) mods = add(mods, tmp_mod);
+ });
+ return mods;
+}
+
+global void ReadHw(){
+ Hardware = ReadHardware("netcard");
+ ReadUdevRules();
+ foreach(map hwitem, Hardware, {
+ list udev = (hwitem["dev_name"]:"" != "") ? udev_rules[hwitem["dev_name"]:""]:[] : [];
+ Items[size(Items)] = $["hwinfo":hwitem, "udev":udev];
+ });
+}
+
+global void ReadNetworkModules(){
+ NetworkModules::Read();
+y2internal("NetworkModules::ListM %1", NetworkModules::ListM(""));
+}
+
+global void ReadNetworkInterfaces(){
+ NetworkDevices::Read();
+ NetworkDevices::CleanHotplugSymlink();
+ foreach(string tmpdevname, (list<string>)Map::Keys(NetworkDevices::FilterDevices("netcard")["eth"]:$[]), {
+ string confname = NetworkDevices::device_name("eth", tmpdevname);
+ map config = getcfg(confname, "");
+ integer pos = nil;
+ map<string, any> val = $[];
+ foreach(integer key, map<string, any> value, (map<integer, map<string, any> >)Items, {
+ if (config["HWD_DEVICEPATH"]:"" == sformat("/sys%1", value["hwinfo", "sysfs_id"]:"")) {
+ pos = key;
+ val = value;
+ }
+ });
+ if (pos == nil) {
+ pos=size(Items);
+ Items[pos]=$[];
+ }
+ Items[pos, "hwcfg"] = val[sformat("HWD_INTERFACE_%1", tointeger(val["HWD_INTERFACE_N"]:"0")-1)]:"";
+ Items[pos, "ifcfg"] = confname;
+ });
+}
+
+list GetDescr(){
+ list descr = [];
+ foreach(integer key, map<string, any> value, (map<integer, map<string, any> >)Items, {
+ if ( haskey(value, "table_descr") && size(Items[key, "table_descr"]:$[])>1)
+ descr = add(descr, $["id":key,
+ "rich_descr":Items[key, "table_descr", "rich_descr"]:"",
+ "table_descr":Items[key, "table_descr", "table_descr"]:[]
+ ]);
+ });
+ return descr;
+}
+
+/**
+ * Create an overview table with all configured devices
+ * @return table items
+ */
+global list Overview() {
+ list unconfigured = Map::Keys(Items);
+
+ foreach( term card, (list<term>) BuildOverview("netcard", Hardware), {
+ string id = card[0,0]:"";
+ list desc = [ card[1]:"", card[2]:""];
+ foreach(integer key, (list<integer>)Map::Keys(Items), {
+ if (Items[key, "ifcfg"]:"" == id && hasAnyValue(id)){
+ Items[key, "table_descr"] = $[
+ "rich_descr" : card[3]: (desc[1]:_("Unknown")),
+ "table_descr": desc
+ ];
+ unconfigured = filter(integer row, (list<integer>)unconfigured, {return(row!=key);});
+ }
+ });
+ });
+
+ list unconf_hwinfo=[];
+ foreach(integer row, (list<integer>)unconfigured, {
+ unconf_hwinfo = add(unconf_hwinfo, Items[row, "hwinfo"]:$[]);
+ });
+ list <map<string,any> > unconf = BuildUnconfiguredCommon (unconf_hwinfo, "netcard");
+ integer pos=0;
+ foreach(integer key, map<string, any> value, (map<integer, map<string, any> >)Items, {
+ if (size(value["ifcfg"]:"")==0) {
+ Items[key, "table_descr"] = $[
+ "rich_descr" : unconf[pos, "rich_descr"]:_("Unknown"),
+ "table_descr": unconf[pos, "table_descr"]:[]
+ ];
+ pos=pos+1;
+ }
+ });
+
+ return GetDescr();
+}
+
+global boolean IsItemConfigured(){
+ boolean ret = false;
+ if (size(Items[current, "ifcfg"]:"")>0) ret = true;
+ y2internal("item %1 configured: %2", current, ret);
+ return ret;
+}
+
+global string GetItemDescription(){
+ return Items[current, "table_descr", "rich_descr"]:"";
+}
+
+
+/**
+ * Check if the given device has any virtual alias.
+ * @param dev device to be checked
+ * @return true if there are some aliases
+ */
+global define boolean InterfaceHasAliases() {
+ return NetworkDevices::HasAliases(Items[current, "ifcfg"]:"");
+}
+
+/**
+ * Select the hardware component
+ * @param hw the component
+ */
+global void SelectHWMap (map hardware) {
+// sysfs_id = hardware["sysfs_id"]:"";
+ map sel = SelectHardwareMap (hardware);
+
+ /* common stuff */
+ description = sel["name"]:"";
+ type = sel["type"]:"eth";
+ hotplug = sel["hotplug"]:"";
+
+ unique = sel["udi"]:"";
+ Requires = sel["requires"]:[];
+ // #44977: Requires now contain the appropriate kernel packages
+ // but they are handled differently due to multiple kernel flavors
+ // (see Package::InstallKernel)
+ // Leave only those not starting with "kernel".
+ Requires = filter (string r, Requires, ``( search (r, "kernel") != 0 ));
+ y2milestone ("requires=%1", Requires);
+
+ // FIXME: devname
+ hotplug = "";
+ if(hotplug == "") {
+ // FIXME: MOD Module["module"] = hw["module"]:"";
+ // FIXME: MOD Module["options"] = hw["options"]:"";
+ NetworkModules::Alias = hardware["module"]:"";
+ NetworkModules::Options = hardware["options"]:"";
+ }
+ else
+ y2milestone("HOTPLUG(%1) -> ignoring modprobe.conf", hotplug);
+
+ // Wireless Card Features
+ wl_auth_modes = hardware["wl_auth_modes"]:nilliststring;
+ wl_enc_modes = hardware["wl_enc_modes"]:nilliststring;
+ wl_channels = hardware["wl_channels"]:nilliststring;
+ wl_bitrates = hardware["wl_bitrates"]:nilliststring;
+
+ string mac = hardware["mac"]:"";
+ string busid = hardware["busid"]:"";
+
+
+ nm_name = createHwcfgName(hardware, type);
+
+ interfacename = hardware["dev_name"]:"";
+
+ // name of ifcfg
+ /* eth, tr, not on s390 (#38819) */
+ if(!Arch::s390 () && mac != nil && mac != "" && mac != "00:00:00:00:00:00")
+ device = "id-" + hardware["mac"]:"";
+ /* iucv already filled in from lan/hardware.ycp (#42212) */
+ else if(type == "iucv")
+ y2debug("IUCV: %1", device);
+ /* other devs */
+ else if(busid != nil && busid != "")
+ device = "bus-" + hardware["bus"]:"" + "-" + hardware["busid"]:"";
+ /* USB, PCMCIA */
+ else if(hardware["hotplug"]:"" != "")
+ device = "bus-" + hardware["hotplug"]:"";
+ /* dummy */
+ else
+ y2milestone("No detailed HW info: %1", device);
+
+ y2milestone("hw=%1", hardware);
+ y2milestone("device=%1", device);
+ hw=hardware;
+}
+
+/**
+ * Select the hardware component
+ * @param which index of the component
+ */
+
+global define void SelectHW(integer which) {
+ SelectHWMap (FindHardware (Hardware, which));
+}
+
+
+
+/*-------------------*/
+/* PRIVATE FUNCTIONS */
+
+/**
+ * Return 10 free devices
+ * @param type device type
+ * @return list of 10 free devices
+ */
+global define list FreeDevices(string type) {
+ return NetworkDevices::GetFreeDevices(type, 10);
+}
+
+/**
+ * Return 10 free aliases
+ * @param type device type
+ * @param num device number
+ * @return list of 10 free devices
+ */
+global define list FreeAliases(string type, integer num) {
+ // FIXME: NI y2debug("Devices=%1", Devices);
+ map Devices_1 = $[]; // FIXME: NI Devices[type, sformat("%1",num)]:$[];
+ y2debug("Devices=%1", Devices_1);
+ return NetworkDevices::GetFreeDevices("_aliases", 10);
+}
+
+
+/**
+ * must be in sync with @ref SetDefaultsForHW
+ */
+global map GetDefaultsForHW () {
+ map ret = $[];
+ if (type == "wlan")
+ {
+ ret = union (
+ ret, $[
+ "USERCONTROL": "yes", // #63767
+ ]);
+ }
+ // LCS eth interfaces on s390 need the MTU of 1492. #81815.
+ // TODO: lcs, or eth?
+ // will eth not get mapped to lcs?
+ // Apparently both LCS eth and LCS tr are represented as "lcs"
+ // but it does not hurt to change the default also for tr
+ // #93798: limit to s390 to minimize regressions. Probably it could
+ // be also done by only testing for lcs and not eth but that
+ // would need more testing.
+ else if (Arch::s390 () && contains (["lcs", "eth"], type))
+ {
+ y2milestone ("Adding LCS: setting MTU");
+ ret = add (ret, "MTU", "1492");
+ }
+ return ret;
+}
+
+/**
+ * must be in sync with @ref GetDefaultsForHW
+ */
+global define void SetDefaultsForHW () {
+ if (type == "wlan")
+ {
+ usercontrol = true;
+ }
+ else if (Arch::s390 () && contains (["lcs", "eth"], type))
+ {
+ mtu = "1492";
+ }
+
+ if (!needHwcfg(hw)){
+ nm_name_old = nm_name;
+ nm_name = "";
+ }
+ y2milestone("hwcfg name %1", nm_name);
+}
+
+string GetDeviceVar (map primary, map fallback, string key) {
+ string ret = (string) primary[key]:fallback[key]:nil;
+ if (ret == nil)
+ {
+ y2debug ("%1 does not have a default defined", key);
+ }
+ return ret;
+}
+
+
+/**
+ * Set various device variables
+ * @param devmap map with variables
+ * @return void
+ */
+global void SetDeviceVars(map devmap, map defaults) {
+ /* address options */
+ bootproto = GetDeviceVar (devmap, defaults, "BOOTPROTO");
+ ipaddr = GetDeviceVar (devmap, defaults, "IPADDR");
+ remoteip = GetDeviceVar (devmap, defaults, "REMOTE_IPADDR");
+ netmask = GetDeviceVar (devmap, defaults, "NETMASK");
+
+ mtu = GetDeviceVar (devmap, defaults, "MTU");
+ ethtool_options = GetDeviceVar (devmap, defaults, "ETHTOOL_OPTIONS");
+ startmode = GetDeviceVar (devmap, defaults, "STARTMODE");
+ usercontrol = GetDeviceVar (devmap, defaults, "USERCONTROL") == "yes";
+ description = GetDeviceVar (devmap, defaults, "NAME");
+ bond_option = GetDeviceVar(devmap, defaults, "BONDING_MODULE_OPTS");
+
+ bond_slaves=[];
+ foreach(any key, any value, devmap,
+ {
+ if (regexpmatch((string)key, "BONDING_SLAVE[0-9]+"))
+ if ((string)value != nil)
+ bond_slaves = add(bond_slaves, (string)value);
+ });
+
+ /* wireless options */
+ wl_mode = GetDeviceVar (devmap, defaults, "WIRELESS_MODE");
+ wl_essid = GetDeviceVar (devmap, defaults, "WIRELESS_ESSID");
+ wl_nwid = GetDeviceVar (devmap, defaults, "WIRELESS_NWID");
+ wl_auth_mode = GetDeviceVar (devmap, defaults, "WIRELESS_AUTH_MODE");
+ wl_wpa_psk = GetDeviceVar (devmap, defaults, "WIRELESS_WPA_PSK");
+ wl_key_length = GetDeviceVar (devmap, defaults, "WIRELESS_KEY_LENGTH");
+ wl_key = []; // ensure exactly 4 entries
+ wl_key[0] = GetDeviceVar (devmap, defaults, "WIRELESS_KEY_0");
+ if (wl_key[0]:"" == "")
+ {
+ wl_key[0] = GetDeviceVar (devmap, defaults, "WIRELESS_KEY");
+ }
+ wl_key[1] = GetDeviceVar (devmap, defaults, "WIRELESS_KEY_1");
+ wl_key[2] = GetDeviceVar (devmap, defaults, "WIRELESS_KEY_2");
+ wl_key[3] = GetDeviceVar (devmap, defaults, "WIRELESS_KEY_3");
+
+ wl_default_key = tointeger (GetDeviceVar (devmap, defaults, "WIRELESS_DEFAULT_KEY"));
+ wl_nick = GetDeviceVar (devmap, defaults, "WIRELESS_NICK");
+
+ wl_wpa_eap = $[];
+ wl_wpa_eap["WPA_EAP_MODE"] = GetDeviceVar (devmap, defaults, "WIRELESS_EAP_MODE");
+ wl_wpa_eap["WPA_EAP_IDENTITY"] = GetDeviceVar (devmap, defaults, "WIRELESS_WPA_IDENTITY");
+ wl_wpa_eap["WPA_EAP_PASSWORD"] = GetDeviceVar (devmap, defaults, "WIRELESS_WPA_PASSWORD");
+ wl_wpa_eap["WPA_EAP_ANONID"] = GetDeviceVar (devmap, defaults, "WIRELESS_WPA_ANONID");
+ wl_wpa_eap["WPA_EAP_CLIENT_CERT"] = GetDeviceVar (devmap, defaults, "WIRELESS_CLIENT_CERT");
+ wl_wpa_eap["WPA_EAP_CLIENT_KEY"] = GetDeviceVar (devmap, defaults, "WIRELESS_CLIENT_KEY");
+ wl_wpa_eap["WPA_EAP_CLIENT_KEY_PASSWORD"] = GetDeviceVar (devmap, defaults, "WIRELESS_CLIENT_KEY_PASSWORD");
+ wl_wpa_eap["WPA_EAP_CA_CERT"] = GetDeviceVar (devmap, defaults, "WIRELESS_CA_CERT");
+ wl_wpa_eap["WPA_EAP_AUTH"] = GetDeviceVar (devmap, defaults, "WIRELESS_EAP_AUTH");
+ wl_wpa_eap["WPA_EAP_PEAP_VERSION"] = GetDeviceVar (devmap, defaults, "WIRELESS_PEAP_VERSION");
+
+ wl_channel = GetDeviceVar (devmap, defaults, "WIRELESS_CHANNEL");
+ wl_frequency = GetDeviceVar (devmap, defaults, "WIRELESS_FREQUENCY");
+ wl_bitrate = GetDeviceVar (devmap, defaults, "WIRELESS_BITRATE");
+ wl_accesspoint = GetDeviceVar (devmap, defaults, "WIRELESS_AP");
+ wl_power = GetDeviceVar (devmap, defaults, "WIRELESS_POWER") == "yes";
+
+ /* s/390 options */
+ portname = GetDeviceVar (devmap, defaults, "PORTNAME");
+
+ aliases = devmap["_aliases"]:$[];
+
+ return;
+}
+
+
+/**
+ * the defaults here are what sysconfig defaults to
+ * (as opposed to what a new interface gets, in @ref Select)
+ */
+global map<string, string> SysconfigDefaults = $[
+ "BOOTPROTO": "static",
+ "IPADDR": "",
+ "REMOTE_IPADDR": "",
+ "NETMASK": "",
+ "MTU": "",
+ "ETHTOOL_OPTIONS": "",
+ "NAME": "",
+ "STARTMODE": "manual",
+ "USERCONTROL": "no",
+ "WIRELESS_MODE": "Managed",
+ "WIRELESS_ESSID": "",
+ "WIRELESS_NWID": "",
+ "WIRELESS_AUTH_MODE": "open",
+ "WIRELESS_WPA_PSK": "",
+ "WIRELESS_KEY_LENGTH": "128",
+ "WIRELESS_KEY": "",
+ "WIRELESS_KEY_0": "",
+ "WIRELESS_KEY_1": "",
+ "WIRELESS_KEY_2": "",
+ "WIRELESS_KEY_3": "",
+ "WIRELESS_DEFAULT_KEY": "0",
+ "WIRELESS_NICK": "",
+ "WIRELESS_WPA_IDENTITY": "",
+ "WIRELESS_WPA_PASSWORD": "",
+ "WIRELESS_CLIENT_CERT": "",
+ "WIRELESS_CA_CERT": "",
+ "WIRELESS_CHANNEL": "",
+ "WIRELESS_FREQUENCY": "",
+ "WIRELESS_BITRATE": "auto",
+ "WIRELESS_AP": "",
+ "WIRELESS_POWER": "yes",
+ "PORTNAME": "",
+ // aliases = devmap["_aliases"]:$[]; // ?
+ "WIRELESS_EAP_MODE": "",
+ "WIRELESS_WPA_IDENTITY": "",
+ "WIRELESS_WPA_PASSWORD": "",
+ "WIRELESS_WPA_ANONID": "",
+ "WIRELESS_CLIENT_CERT": "",
+ "WIRELESS_CLIENT_KEY": "",
+ "WIRELESS_CLIENT_KEY_PASSWORD": "",
+ "WIRELESS_CA_CERT": "",
+ "WIRELESS_EAP_AUTH": "",
+ "WIRELESS_PEAP_VERSION": "",
+
+ "BONDING_MODULE_OPTS": "",
+ ];
+
+global list<string> GetItemUdev(){
+// column: 0 mens rule, 1 means device
+ list<string> udevs=["", ""];
+ if (size(Items[current, "udev"]:[])>3)
+ {
+ udevs[0]=Items[current, "udev", 2]:"";
+ if (regexpmatch (Items[current, "udev", 3]:"", ".* [^ ]*\"$")) {
+ udevs[1]=regexpsub (Items[current, "udev", 3]:"", ".* ([^ ]*)\"$", "\\1");
+ }
+ }
+ return udevs;
+}
+
+/**
+ * Select the given device
+ * @param dev device to select ("" for new device, default values)
+ * @return true if success
+ */
+global define boolean Select(string dev) {
+ y2debug("dev=%1", dev);
+ map devmap = $[];
+ /* dev=="" -> Add */
+ if(dev == "") {
+ // defaults for a new device
+ devmap = $[
+ "STARTMODE": "auto", // #115448, #156388
+ "NETMASK": (NetHwDetection::result["NETMASK"]:"255.255.255.0"), // #31369
+ ];
+ string product_startmode = ProductFeatures::GetStringFeature ("network", "startmode");
+ if (contains (["auto", "ifplugd"], product_startmode))
+ {
+ y2milestone ("Product startmode: %1", product_startmode);
+ if (product_startmode == "ifplugd" && ! Arch::is_laptop ())
+ {
+ // #164816
+ y2milestone ("Not a laptop, will not prefer ifplugd");
+ product_startmode = "auto";
+ }
+ devmap["STARTMODE"] = product_startmode;
+ }
+
+ type = "eth";
+ device = NetworkDevices::GetFreeDevice(type);
+
+ // FIXME: MOD AddModule(type);
+ NetworkModules::AddM();
+ nm_name = NetworkModules::GetFreeName("static-");
+
+ NetworkDevices::Name = GetItemUdev()[1]:"";
+ LanItems::Items[LanItems::current, "ifcfg"] = NetworkDevices::Name;
+
+// interfacename = GetItemUdev()[1]:"";
+// y2internal("interfacename %1", interfacename);
+
+ /* FIXME: alias: how to prefill new alias? */
+ alias = "";
+ }
+ /* dev!="" -> Edit */
+ else {
+ /* FIXME: NI:
+ if(!CheckDevice(dev)) {
+ y2error("Device not found: %1", dev);
+ return false;
+ }
+ */
+ NetworkDevices::Edit(dev);
+ devmap = NetworkDevices::Current;
+ type = NetworkDevices::device_type(dev);
+ device = NetworkDevices::device_num(dev);
+ alias = NetworkDevices::alias_num(dev);
+ nm_name = devmap["_nm_name"]:"";
+
+ if (nm_name==""){
+ nm_name="";
+ NetworkModules::AddM();
+ nm_name_old = NetworkModules::GetFreeName("static-");
+ }
+ }
+
+ /* general stuff */
+ description = BuildDescription (type, device, devmap, Hardware);
+
+ unique = devmap["udi"]:"";
+ SetDeviceVars(devmap, SysconfigDefaults);
+
+
+ hotplug = "";
+ /*
+ if(issubstring(device, "bus-pcmcia"))
+ hotplug = "pcmcia";
+ else if(issubstring(device, "bus-usb"))
+ hotplug = "usb";
+ */
+
+ y2debug("type=%1", type);
+ if(issubstring(type, "-"))
+ type = regexpsub(type, "([^-]+)-.*$", "\\1");
+ y2debug("type=%1", type);
+
+ /* kernel options */
+ if(hotplug == "" && alias == "" && nm_name != "") {
+ // FIXME: MOD SelectModule(dev);
+ NetworkModules::SelectM(nm_name);
+ }
+ else {
+ // FIXME: MOD SelectModule("");
+ NetworkModules::AddM();
+ }
+
+ qeth_options = NetworkModules::QETH_OPTIONS;
+ chan_mode = NetworkModules::CCW_CHAN_MODE;
+ lcs_timeout = NetworkModules::LCS_LANCMD_TIMEOUT;
+
+ if (NetworkModules::QETH_IPA_TAKEOVER == nil ||
+ NetworkModules::QETH_IPA_TAKEOVER == "" ||
+ NetworkModules::QETH_IPA_TAKEOVER == "0")
+ ipa_takeover = false;
+ else
+ ipa_takeover = true;
+
+ if (NetworkModules::QETH_LAYER2_SUPPORT == nil ||
+ NetworkModules::QETH_LAYER2_SUPPORT == "" ||
+ NetworkModules::QETH_LAYER2_SUPPORT == "0")
+ qeth_layer2 = false;
+ else
+ qeth_layer2 = true;
+
+ /* We always have to set the MAC Address for qeth Layer2 support */
+ if (qeth_layer2 ) {
+ qeth_macaddress = devmap["LLADDR"]:"00:00:00:00:00:00";
+ }
+
+ //if(bootproto == "none") bootproto = "static";
+
+ return true;
+}
+
+// ifplugd sometimes does not work for wifi
+// so wired needs higher priority to override it
+map <string, string> ifplugd_priorities = $[
+ "eth": "20",
+ "wlan": "10",
+ ];
+
+
+/**
+ * Commit pending operation
+ * @return true if success
+ */
+global define boolean Commit() {
+
+ if(operation == `add || operation == `edit) {
+ map<string,any> newdev = $[];
+
+ // #104494 - always write IPADDR+NETMASK, even empty
+ newdev["IPADDR"] = ipaddr;
+ newdev["NETMASK"] = netmask;
+ // #50955 omit computable fields
+ newdev["BROADCAST"] = "";
+ newdev["NETWORK"] = "";
+
+ newdev["REMOTE_IPADDR"] = remoteip;
+
+ if(alias == "") {
+ newdev["MTU"] = mtu;
+ newdev["ETHTOOL_OPTIONS"] = ethtool_options;
+ newdev["STARTMODE"] = startmode;
+ // it is not in Select yet because we don't have a widget for it
+ if (startmode == "ifplugd")
+ {
+ string prio = ifplugd_priorities[type]:"";
+ newdev["IFPLUGD_PRIORITY"] = prio;
+ }
+ newdev["USERCONTROL"] = usercontrol? "yes": "no";
+ newdev["BOOTPROTO"] = bootproto;
+ newdev["NAME"] = description;
+ }
+
+// if(unique != "" && unique != nil) newdev["udi"] = unique;
+
+ if(hotplug == "") {
+ if(alias == "") {
+ // FIXME: MOD ChangeModule(NetworkDevices::device_name(type, device), operation == `add);
+ y2milestone("HWCFG name %1 (%2)", nm_name, nm_name_old);
+ if(hasAnyValue(nm_name) && operation == `edit &&
+ hasAnyValue(nm_name_old) && nm_name != nm_name_old) {
+ y2milestone("HWCFG name change (%1) -> deleting old (%2)", nm_name, nm_name_old);
+ NetworkModules::DeleteM(nm_name_old);
+ nm_name_old = nil;
+ }
+
+ if(Arch::s390 ()) {
+ string type2 = DriverType (type);
+ if(type2 == "iucv") {
+ NetworkModules::SCRIPTUP = "hwup-iucv";
+ }
+ else {
+ NetworkModules::SCRIPTUP = "hwup-ccw";
+ NetworkModules::SCRIPTUP_ccw = "hwup-ccw";
+ NetworkModules::SCRIPTDOWN = "hwdown-ccw";
+ NetworkModules::SCRIPTUP_ccwgroup = "hwup-" + type2;
+ }
+
+ integer devid = 0;
+ string devstr = "";
+
+ y2milestone("nm_name=%1", nm_name);
+ string s390chanid = "[0-9]+\\.[0-9]+\\.";
+ if(regexpmatch(nm_name, s390chanid)) {
+ devid = tointeger("0x" + regexpsub(nm_name, s390chanid + "(.*)", "\\1"));
+ devstr = regexpsub(nm_name, ".*[^0-9](" + s390chanid + ").*", "\\1");
+ }
+
+ y2milestone("devid=%1(%2)", devid, devstr);
+ if(devid == nil) devid = 0;
+ string devid0 = String::PadZeros(regexpsub(tohexstring(devid), "0x(.*)", "\\1"), 4);
+ string devid1 = String::PadZeros(regexpsub(tohexstring(devid+1), "0x(.*)", "\\1"), 4);
+ string devid2 = String::PadZeros(regexpsub(tohexstring(devid+2), "0x(.*)", "\\1"), 4);
+
+ if(type2 == "ctc" || type2 == "lcs") {
+ NetworkModules::CCW_CHAN_IDS = sformat("%1%2 %1%3", devstr, devid0, devid1);
+ NetworkModules::CCW_CHAN_MODE = chan_mode;
+ NetworkModules::CCW_CHAN_NUM = "2";
+ NetworkModules::LCS_LANCMD_TIMEOUT = lcs_timeout;
+ }
+ else if(type2 == "qeth") {
+ NetworkModules::CCW_CHAN_IDS = sformat("%1%2 %1%3 %1%4", devstr, devid0, devid1, devid2);
+ NetworkModules::CCW_CHAN_MODE = chan_mode;
+ NetworkModules::CCW_CHAN_NUM = "3";
+ NetworkModules::QETH_OPTIONS = qeth_options;
+ NetworkModules::QETH_IPA_TAKEOVER = ipa_takeover? "1": "0";
+ NetworkModules::QETH_LAYER2_SUPPORT = qeth_layer2? "1": "0";
+ if (qeth_layer2 && qeth_macaddress != "00:00:00:00:00:00") {
+ newdev["LLADDR"] = qeth_macaddress;
+ }
+ else {
+ // #151196: layer 3 otherwise fails
+ newdev["LLADDR"] = "";
+ }
+ }
+
+ }
+
+ // If "", no hwcfg is created. See also #42421.
+ if (NetworkModules::ChangeM(nm_name)) Items[current, "hwcfg"]=nm_name;
+ else Items[current, "hwcfg"]="";
+ }
+ }
+
+ if(hotplug == "pcmcia") newdev["DHCLIENT_SET_DOWN_LINK"] = "yes";
+
+
+ if (type == "bond")
+ {
+ integer i = 0;
+ foreach (string slave, bond_slaves,
+ {
+ newdev[sformat("BONDING_SLAVE%1", i)] = slave;
+ i = i + 1;
+ });
+
+ //assign nil to rest BONDING_SLAVEn to remove them
+ while (i<10)
+ {
+ newdev[sformat("BONDING_SLAVE%1", i)] = nil;
+ i = i + 1;
+ };
+
+ newdev["BONDING_MODULE_OPTS"] = bond_option;
+
+ //BONDING_MASTER always is yes
+ newdev["BONDING_MASTER"] = "yes";
+ }
+
+ if(type == "wlan") {
+ newdev["WIRELESS_MODE"] = wl_mode;
+ newdev["WIRELESS_ESSID"] = wl_essid;
+ newdev["WIRELESS_NWID"] = wl_nwid;
+ newdev["WIRELESS_AUTH_MODE"] = wl_auth_mode;
+ newdev["WIRELESS_WPA_PSK"] = wl_wpa_psk;
+ newdev["WIRELESS_KEY_LENGTH"] = wl_key_length;
+ // obsoleted by WIRELESS_KEY_0
+ newdev["WIRELESS_KEY"] = ""; // TODO: delete the varlable
+ newdev["WIRELESS_KEY_0"] = wl_key[0]:"";
+ newdev["WIRELESS_KEY_1"] = wl_key[1]:"";
+ newdev["WIRELESS_KEY_2"] = wl_key[2]:"";
+ newdev["WIRELESS_KEY_3"] = wl_key[3]:"";
+ newdev["WIRELESS_DEFAULT_KEY"] = tostring (wl_default_key);
+ newdev["WIRELESS_NICK"] = wl_nick;
+
+ if (wl_wpa_eap != $[])
+ {
+ newdev["WIRELESS_EAP_MODE"] = wl_wpa_eap["WPA_EAP_MODE"]:"";
+ newdev["WIRELESS_WPA_IDENTITY"] = wl_wpa_eap["WPA_EAP_IDENTITY"]:"";
+ newdev["WIRELESS_WPA_PASSWORD"] = wl_wpa_eap["WPA_EAP_PASSWORD"]:"";
+ newdev["WIRELESS_WPA_ANONID"] = wl_wpa_eap["WPA_EAP_ANONID"]:"";
+ newdev["WIRELESS_CLIENT_CERT"] = wl_wpa_eap["WPA_EAP_CLIENT_CERT"]:"";
+ newdev["WIRELESS_CLIENT_KEY"] = wl_wpa_eap["WPA_EAP_CLIENT_KEY"]:"";
+ newdev["WIRELESS_CLIENT_KEY_PASSWORD"] = wl_wpa_eap["WPA_EAP_CLIENT_KEY_PASSWORD"]:"";
+ newdev["WIRELESS_CA_CERT"] = wl_wpa_eap["WPA_EAP_CA_CERT"]:"";
+ newdev["WIRELESS_EAP_AUTH"] = wl_wpa_eap["WPA_EAP_AUTH"]:"";
+ newdev["WIRELESS_PEAP_VERSION"] = wl_wpa_eap["WPA_EAP_PEAP_VERSION"]:"";
+ }
+
+ newdev["WIRELESS_CHANNEL"] = wl_channel;
+ newdev["WIRELESS_FREQUENCY"] = wl_frequency;
+ newdev["WIRELESS_BITRATE"] = wl_bitrate;
+ newdev["WIRELESS_AP"] = wl_accesspoint;
+ newdev["WIRELESS_POWER"] = wl_power ? "yes" : "no";
+ }
+
+ if(hasAnyValue(nm_name)) newdev["_nm_name"] = nm_name;
+
+ if(DriverType (type) == "ctc")
+ if(NetworkConfig::Config["WAIT_FOR_INTERFACES"]:nil == nil || NetworkConfig::Config["WAIT_FOR_INTERFACES"]:0 < 40)
+ NetworkConfig::Config["WAIT_FOR_INTERFACES"] = 40;
+
+ /* FIXME: MOD
+ if(DriverType (type) == "qeth")
+ if(NetworkConfig::Config["WAIT_FOR_INTERFACES"]:nil == nil || NetworkConfig::Config["WAIT_FOR_INTERFACES"]:0 < 15)
+ NetworkConfig::Config["WAIT_FOR_INTERFACES"] = 15;
+ */
+
+ if(alias == "") {
+ newdev["_aliases"] = aliases;
+ y2milestone("aliases %1", aliases);
+ }
+// NetworkDevices::Name = NetworkDevices::device_name(NetworkDevices::RealType(type, hotplug), device);
+// NetworkDevices::Name = interfacename;
+// }
+// else
+// NetworkDevices::Name = NetworkDevices::alias_name(NetworkDevices::RealType(type, hotplug), device, alias);
+
+ NetworkDevices::Name = interfacename;
+ NetworkDevices::Current = newdev;
+ NetworkDevices::Commit();
+ }
+ else {
+ y2error("Unknown operation: %1", operation);
+ return false;
+ }
+ nm_name_old = nil;
+ modified = true;
+ operation = nil;
+ return true;
+}
+
+/**
+ * Get the module configuration for the modules configured in the
+ * interface section
+ * @param ay_device Device, for example eth0
+ * @param ay_modules list of modules from the AY profile
+ * @return map the module map with module name and options
+ */
+global map GetModuleForInterface(string ay_device ,
+ list<map> ay_modules) {
+ map ayret = $[];
+ list<map> ay_filtered = filter(map ay_m, ay_modules,
+ ``(
+ ay_m["device"]:"" == ay_device ));
+
+ if (size(ay_filtered) > 0 ) {
+ ayret = ay_filtered[0]:$[];
+ }
+
+ return ayret;
+}
+
+
+/**
+ * Find matching device
+ * Find a device, optionally with some predefined values
+ * @param interface interface map
+ * @return map The map of the matching device.
+ */
+global map FindMatchingDevice(map interface) {
+ map tosel = nil;
+ // Minimal changes to code to fix both #119592 and #146965
+ // Alternatively we could try to ensure that we never match a
+ // device that got already matched
+ boolean matched_by_module = false;
+
+ list<string> devs = NetworkDevices::List("netcard");
+ y2milestone("Configured devices: %1", devs );
+
+ // this condition is always true for SLES9, HEAD uses $[] for proposal
+ if (interface != $[])
+ {
+ // Notes for comments about matching:
+ // - interface["device"] is the key which we look for in the actual hw
+ // - H iterates over Hardware
+ // - patterns are shell-like
+
+ list device_id = splitstring(interface["device"]:"", "-");
+ /* code for eth-id-00:80:c8:f6:48:4c configurations */
+ // *-id-$ID => find H["mac"] == $ID
+ if (size(device_id)> 1 && device_id[1]:"" == "id")
+ {
+ string hwaddr = device_id[2]:"";
+ if(hwaddr != nil && hwaddr != "") {
+ tosel = find (map h, Hardware, ``( h["mac"]:"" == hwaddr ));
+ }
+ y2milestone("Rule: matching mac in device name");
+ }
+ /* code for eth-bus-pci-0000:00:0d.0 configurations */
+ /* code for eth-bus-vio-30000001 configurations */
+ // *-bus-$BUS-$ID => find H["bus"] == $BUS & H["busid"] == $ID
+ else if (size(device_id)> 2 && device_id[1]:"" == "bus")
+ {
+ string bus = device_id[2]:"";
+ string busid = device_id[3]:"";
+ if(bus != nil && bus != "" && busid != nil && busid != "") {
+ tosel = find (map h, Hardware, ``( h["busid"]:"" == busid
+ && h["bus"]:"" == bus ));
+ }
+ y2milestone("Rule: matching bus id in device name");
+ }
+
+ /* code for module configuration */
+ // join with the modules list of the ay profile according to "device"
+ // if exists => find H["module"] == AH["module"]
+ map aymodule = GetModuleForInterface(interface["device"]:"",
+ autoinstall_settings["modules"]:[]);
+ y2milestone("module data: %1", aymodule );
+ if (tosel == nil && aymodule != $[]) {
+ if(aymodule != nil && aymodule["module"]:"" != "") {
+ tosel = find (map h, LanItems::Hardware, ``( h["module"]:"" == aymodule["module"]:"" ));
+ }
+ if (tosel != nil)
+ {
+ matched_by_module = true;
+ }
+ y2milestone("Rule: matching module configuration");
+ }
+ }
+
+ // First device was already configured, we are now looking for
+ // a second (third,...) one
+ if (size(devs) > 0 )
+ {
+ // #119592, #146965: this used to be unconditional, overwriting the
+ // results of the above matching.
+ if (matched_by_module || tosel == nil)
+ {
+ // go thru all devices, check whether there's one that does
+ // not have a configuration yet
+ // and has the same type as the current profile item
+ foreach (map h, LanItems::Hardware, {
+ y2milestone("Checking for device=%1", h);
+ SelectHWMap(h);
+ string _device_name = NetworkDevices::device_name(NetworkDevices::RealType(type, hotplug), device);
+ if (!NetworkDevices::Check(_device_name) &&
+ type == NetworkDevices::device_type(interface["device"]:"")
+ )
+ {
+ y2milestone("Selected: %1", h );
+ tosel = h;
+ break;
+ }
+ });
+ }
+ if (tosel == nil )
+ {
+ y2error("Nothing found");
+ }
+
+ } else {
+ // this is the first interface, match the hardware with install.inf
+/*
+ // couldn't happen
+ if (size(InstallInf)>0){
+ // Select the one from install.inf with the same MAC
+ // find H["mac"] == InstallInf["hwaddr"]
+ if (tosel == nil ) {
+ string hwaddr = InstallInf["hwaddr"]:"";
+ if(hwaddr != nil && hwaddr != "") {
+ tosel = find (map h, Hardware, ``( h["mac"]:"" == hwaddr ));
+ }
+ y2milestone("Rule: matching hwaddr in install.inf");
+ }
+
+ // Select the one from install.inf with the same module
+ // find H["module"] == InstallInf["module"]
+ if (tosel == nil) {
+ string infmodule = InstallInf["module"]:"";
+ if(infmodule != nil && infmodule != "") {
+ tosel = find (map h, Hardware, ``( h["module"]:"" == infmodule ));
+ }
+ y2milestone("Rule: matching module in install.inf");
+ }
+ } else
+*/
+ {
+ /* No install.inf -> select the first connected */
+ // find H["active"] == true
+ if (tosel == nil) {
+ tosel = find (map h, LanItems::Hardware, ``(
+ h["link", "state"]:false
+ ));
+ y2milestone("Rule: first connected");
+ }
+ }
+
+ /* No install.inf driver -> select the first active */
+ // find H["active"] == true
+ if (tosel == nil) {
+ tosel = find (map h, LanItems::Hardware, ``(
+ h["active"]:false
+ ));
+ y2milestone("Rule: first active");
+ }
+
+ /* No active driver -> select the first with a driver */
+ // find H["module"] != ""
+ if (tosel == nil) {
+ y2milestone("No active driver found, trying further.");
+ tosel = find (map h, LanItems::Hardware, ``(
+ h["module"]:"" != ""
+ && y2milestone("Using driver: %1", h) == nil
+ ));
+ y2milestone("Rule: first with driver");
+ }
+ }
+
+ return tosel;
+}
+
+global void DeleteItem(){
+ y2internal("deleting ... %1", Items[current]:$[]);
+ string ifcfg = Items[current, "ifcfg"]:"";
+ string hwcfg = Items[current, "hwcfg"]:"";
+
+ if (hasAnyValue(ifcfg)) {
+ NetworkDevices::Delete(ifcfg);
+ NetworkDevices::Commit();
+ Items[current, "ifcfg"] = "";
+ }
+ if (hasAnyValue(hwcfg)) {
+ NetworkModules::DeleteM(hwcfg);
+ Items[current, "hwcfg"] = "";
+ }
+ SetModified();
+}
+
+global void SetItem(){
+ operation = `edit;
+ interfacename = Items[current, "ifcfg"]:"";
+ NetworkDevices::Edit(Items[current, "ifcfg"]:"");
+ map devmap = NetworkDevices::Current;
+ type = NetworkDevices::device_type(Items[current, "ifcfg"]:"");
+ device = NetworkDevices::device_num(Items[current, "ifcfg"]:"");
+ alias = NetworkDevices::alias_num(Items[current, "ifcfg"]:"");
+ nm_name = Items[current, "hwcfg"]:"";
+ if (nm_name=="") nm_name_old = createHwcfgName(Items[current, "hwinfo"]:$[], type);
+ NetworkModules::SelectM(nm_name);
+
+ /* general stuff */
+ description = BuildDescription (type, device, devmap, Hardware);
+
+ unique = devmap["udi"]:"";
+ SetDeviceVars(devmap, SysconfigDefaults);
+
+
+ hotplug = "";
+
+ y2debug("type=%1", type);
+ if(issubstring(type, "-")) type = regexpsub(type, "([^-]+)-.*$", "\\1");
+ y2debug("type=%1", type);
+
+ /* kernel options */
+ if(hotplug == "" && alias == "" && nm_name != "") {
+ // FIXME: MOD SelectModule(dev);
+ NetworkModules::SelectM(nm_name);
+ }
+ else {
+ // FIXME: MOD SelectModule("");
+ NetworkModules::AddM();
+ }
+
+ qeth_options = NetworkModules::QETH_OPTIONS;
+ chan_mode = NetworkModules::CCW_CHAN_MODE;
+ lcs_timeout = NetworkModules::LCS_LANCMD_TIMEOUT;
+
+ if (NetworkModules::QETH_IPA_TAKEOVER == nil ||
+ NetworkModules::QETH_IPA_TAKEOVER == "" ||
+ NetworkModules::QETH_IPA_TAKEOVER == "0")
+ ipa_takeover = false;
+ else
+ ipa_takeover = true;
+
+ if (NetworkModules::QETH_LAYER2_SUPPORT == nil ||
+ NetworkModules::QETH_LAYER2_SUPPORT == "" ||
+ NetworkModules::QETH_LAYER2_SUPPORT == "0")
+ qeth_layer2 = false;
+ else
+ qeth_layer2 = true;
+
+ /* We always have to set the MAC Address for qeth Layer2 support */
+ if (qeth_layer2 ) {
+ qeth_macaddress = devmap["LLADDR"]:"00:00:00:00:00:00";
+ }
+
+}
+
+global void AddNew(){
+ y2internal("Name %1", NetworkDevices::Name);
+ current = size(Items)+1;
+}
+
+}
Modified: trunk/network/src/routines/complex.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/routines/complex.ycp…
==============================================================================
--- trunk/network/src/routines/complex.ycp (original)
+++ trunk/network/src/routines/complex.ycp Mon Jul 2 16:53:49 2007
@@ -701,5 +701,14 @@
list sum = BuildSummary (class, Hardware, split, proposal);
return BuildUnconfiguredCommon (sum[size(sum)-1]:[], class);
}
+
+
+
+
+
+
+
+
+
/* EOF */
}
Modified: trunk/network/src/routines/hardware.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/routines/hardware.yc…
==============================================================================
--- trunk/network/src/routines/hardware.ycp (original)
+++ trunk/network/src/routines/hardware.ycp Mon Jul 2 16:53:49 2007
@@ -21,368 +21,7 @@
import "Arch";
import "Confirm";
import "Map";
-
-define string DistinguishedName(string name, map hwdevice) {
- if(hwdevice["sysfs_bus_id"]:"" != "")
- return sformat("%1 (%2)", name, hwdevice["sysfs_bus_id"]:"");
- return name;
-}
-
-/**
- * Extract the device 'name'
- * @param hwdevice hardware device
- * @return name consisting of vendor and device name
- */
-define string DeviceName(map hwdevice) {
- string delimiter = " "; // "\n";
- string model = "";
- string vendor = "";
- string dev = "";
-
- model = hwdevice["model"]:"";
- if(model != "" && model != nil) return model;
-
- vendor = hwdevice["sub_vendor"]:"";
- dev = hwdevice["sub_device"]:"";
-
- if((vendor == "") || (dev == "")) {
- vendor = hwdevice["vendor"]:"";
- dev = hwdevice["device"]:"";
- }
-
- if(vendor != "")
- return vendor + delimiter + dev;
- else
- return dev;
-}
-
-/**
- * Simple convertor from subclass to controller type.
- * @param hwdevice map with card info containing "subclass"
- * @return short device name
- * @example ControllerType(<ethernet controller map>) -> "eth"
- */
-define string ControllerType(map hwdevice) {
-
- if(hwdevice["subclass"]:"" == "Modem") return "modem";
- if(hwdevice["subclass"]:"" == "ISDN") return "isdn";
- if(hwdevice["subclass"]:"" == "DSL") return "dsl";
-
- integer subclass_id = hwdevice["sub_class_id"]:-1;
-
- /* Network controller */
- if(hwdevice["class_id"]:-1 == 2) {
- if(subclass_id == 0) return "eth";
- else if(subclass_id == 1) return "tr";
- else if(subclass_id == 2) return "fddi";
- else if(subclass_id == 3) return "atm";
- else if(subclass_id == 4) return "isdn";
- else if(subclass_id == 0x81) return "myri";
- else if(subclass_id == 0x82) return "wlan";
- else if(subclass_id == 0x83) return "xp";
- else if(subclass_id == 0x86) return "qeth";
- else if(subclass_id == 0x87) return "hsi";
- else if(subclass_id == 0x88) return "ctc";
- else if(subclass_id == 0x89) return "lcs";
- else if(subclass_id == 0x8E) return "ficon";
- else if(subclass_id == 0x8F) return "escon";
- else if(subclass_id == 0x90) return "iucv";
- else if(subclass_id == 0x91) return "usb"; // #22739
- else if(subclass_id == 0x80) {
- /* Nothing was found */
- y2error("Unknown network controller type: %1", hwdevice);
- y2error("It's probably missing in hwinfo (NOT src/hd/hd.h:sc_net_if)");
- return "";
- }
- else {
- /* Nothing was found */
- y2error("Unknown network controller type: %1", hwdevice);
- return "";
- }
-
- }
- /* Communication controller */
- if(hwdevice["class_id"]:-1 == 7) {
- if(subclass_id == 3) return "modem";
- else if(subclass_id == 0x80) {
- /* Nothing was found */
- y2error("Unknown network controller type: %1", hwdevice);
- y2error("It's probably missing in hwinfo (src/hd/hd.h:sc_net_if)");
- return "";
- }
- else {
- /* Nothing was found */
- y2error("Unknown network controller type: %1", hwdevice);
- return "";
- }
-
- }
- /* Network Interface */
- // check the CVS history and then kill this code!
- // 0x107 is the output of hwinfo --network
- // which lists the INTERFACES
- // but we are inteested in hwinfo --netcard
- // Just make sure that hwinfo or ag_probe
- // indeed does not pass this to us
- else if(hwdevice["class_id"]:-1 == 0x107) {
- y2milestone ("CLASS 0x107"); // this should happen rarely
- if(subclass_id == 0) return "lo";
- else if(subclass_id == 1) return "eth";
- else if(subclass_id == 2) return "tr";
- else if(subclass_id == 3) return "fddi";
- else if(subclass_id == 4) return "ctc";
- else if(subclass_id == 5) return "iucv";
- else if(subclass_id == 6) return "hsi";
- else if(subclass_id == 7) return "qeth";
- else if(subclass_id == 8) return "escon";
- else if(subclass_id == 9) return "myri";
- else if(subclass_id == 10) return "wlan";
- else if(subclass_id == 11) return "xp";
- else if(subclass_id == 12) return "usb";
- else if(subclass_id == 0x80) {
- /* Nothing was found */
- y2error("Unknown network interface type: %1", hwdevice);
- y2error("It's probably missing in hwinfo (src/hd/hd.h:sc_net_if)");
- return "";
- }
- else if(subclass_id == 0x81) return "sit";
- else {
- /* Nothing was found */
- y2error("Unknown network interface type: %1", hwdevice);
- return "";
- }
- }
- else if(hwdevice["class_id"]:-1 == 0x102)
- return "modem";
- else if(hwdevice["class_id"]:-1 == 0x103)
- return "isdn";
- else if(hwdevice["class_id"]:-1 == 0x114)
- return "dsl";
-
- /* Nothing was found */
- y2error("Unknown controller type: %1", hwdevice);
- return "";
-}
-
-/**
- * Read HW information
- * @param hwtype type of devices to read (netcard|modem|isdn)
- * @return true if success
- */
-define list<map> ReadHardware(string hwtype) {
- list<map> Hardware = [];
-
- y2debug("hwtype=%1", hwtype);
-
- integer num = 0;
- list paths = [];
- list allcards = [];
-
- map<string,path> hwtypes = $[
- "netcard" : .probe.netcard,
- "modem" : .probe.modem,
- "isdn" : .probe.isdn,
- "dsl" : .probe.dsl,
- ];
-
- map<string,string> hwstrings = $[
- /* Confirmation: label text (detecting hardware: xxx) */
- "netcard" : _("Network Cards"),
- /* Confirmation: label text (detecting hardware: xxx) */
- "modem" : _("Modems"),
- /* Confirmation: label text (detecting hardware: xxx) */
- "isdn" : _("ISDN Cards"),
- /* Confirmation: label text (detecting hardware: xxx) */
- "dsl" : _("DSL Devices"),
- ];
-
- /* Confirmation: label text (detecting hardware: xxx) */
- string hwstring = _("All Network Devices");
- if(haskey(hwstrings, hwtype)) hwstring = hwstrings[hwtype]:"";
- if(!Confirm::Detection(hwstring)) return [];
-
- /* read the corresponding hardware */
- if(haskey(hwtypes, hwtype))
- allcards = (list) SCR::Read(hwtypes[hwtype]:nil);
- else if(hwtype == "all" || hwtype == "" || hwtype == nil)
- maplist(path v, (list<path>) Map::Values(hwtypes), {
- allcards = merge(allcards, (list) SCR::Read(v));
- });
- else {
- y2error("unknown hwtype: %1", hwtype);
- return [];
- }
-
- if(allcards == nil) {
- y2error("hardware detection failure");
- allcards = [];
- }
-
- // #97540
- string bms = (string)SCR::Read (.etc.install_inf.BrokenModules);
- if (bms == nil) bms = "";
- list<string> broken_modules = splitstring (bms, " ");
-
- /* fill in the hardware data */
- maplist(map card, (list<map>) allcards, {
- map one = $[];
-
- /* common stuff */
- map resource = card["resource"]:$[];
- string controller = ControllerType(card);
- boolean card_ok = controller != "";
- one["name"] = DeviceName(card);
- one["type"] = controller;
- one["udi"] = card["udi"]:"";
- one["sysfs_id"] = card["sysfs_id"]:"";
- one["requires"] = card["requires"]:[];
- // Each card remembers its position in the list of _all_ cards.
- // It is used when selecting the card from the list of _unconfigured_
- // ones (which may be smaller). #102945.
- one["num"] = num;
-
- /* Temporary solution for s390: #40587 */
- if(Arch::s390 ()) one["name"] = DistinguishedName(one["name"]:"", card);
-
- /* modem */
- if(controller == "modem") {
- one["device_name"] = card["dev_name"]:"";
- one["drivers"] = card["drivers"]:[];
- integer speed = resource["baud", 0, "speed"]:57600;
- // :-) have to check .probe and libhd if this confusion is
- // really necessary. maybe a pppd bug too? #148893
- if (speed == 12000000)
- {
- speed = 57600;
- y2milestone ("Driving faster than light is prohibited on this planet.");
- }
- one["speed"] = speed;
- one["init1"] = resource["init_strings", 0, "init1"]:"";
- one["init2"] = resource["init_strings", 0, "init2"]:"";
- one["pppd_options"] = resource["pppd_option", 0, "option"]:"";
- }
- /* isdn card */
- else if(controller == "isdn") {
- list drivers = card["isdn"]:[];
- one["drivers"] = drivers;
- one["sel_drv"] = 0;
- one["bus"] = card["bus"]:"";
- one["io"] = resource["io", 0, "start"]:0;
- one["irq"] = resource["irq", 0, "irq"]:0;
- }
- /* dsl card */
- else if(controller == "dsl") {
- map driver_info = card["dsl", 0]:$[];
- map<string, string> translate_mode = $[
- "capiadsl": "capi-adsl",
- "pppoe": "pppoe",
- ];
- string m = driver_info["mode"]:"";
- one["pppmode"] = translate_mode[m]:m;
- // driver_info["name"]:"" has no use here??
- }
- /* treat the rest as a network card */
- else if(controller != "") {
- // drivers:
- // Although normally there is only one module
- // (one=$[active:, module:, options:,...]), the generic
- // situation is: one or more driver variants (exclusive),
- // each having one or more modules (one[drivers])
-
- // only drivers that are not marked as broken (#97540)
- list drivers = filter (map d, (list<map>) card["drivers"]:[], {
- // ignoring more modules per driver...
- list module0 = d["modules", 0]:[]; // [module, options]
- boolean brk = contains (broken_modules, module0[0]:"");
- if (brk)
- {
- y2milestone ("In BrokenModules, skipping: %1", module0);
- }
- return !brk;
- });
-
- if (drivers == [])
- {
- y2milestone ("No good drivers found");
- // #153235
- // fail, unless we are in xen (it has the driver built in)
- card_ok = Arch::is_xenU ();
- }
- else
- {
- one["drivers"] = drivers;
-
- map driver = drivers[0]:$[];
- one["active"] = driver["active"]:false;
- list module0 = driver["modules", 0]:[]; // [module, options]
- one["module"] = module0[0]:"";
- one["options"] = module0[1]:"";
- }
-
- /* FIXME: this should be also done for modems and others */
- /* FIXME: #13571 */
- string hp = card["hotplug"]:"";
- if(hp == "pcmcia" || hp == "cardbus")
- one["hotplug"] = "pcmcia";
- else if(hp == "usb")
- one["hotplug"] = "usb";
-
- /* store the BUS type */
- string bus = card["bus_hwcfg"]:(card["bus"]:"");
- if(bus == "PCI") bus = "pci";
- else if(bus == "USB") bus = "usb";
- else if(bus == "Virtual IO") bus = "vio";
- one["bus"] = bus;
-
- one["busid"] = card["sysfs_bus_id"]:"";
- one["mac"] = resource["hwaddr", 0, "addr"]:"";
- // is the cable plugged in? nil = don't know
- one["link"] = resource["link", 0, "state"]:nil;
-
- // Wireless Card Features
- one["wl_channels"] = resource["wlan", 0, "channels"]:nil;
- //one["wl_frequencies"] = resource["wlan", 0, "frequencies"]:nil;
- one["wl_bitrates"] = resource["wlan", 0, "bitrates"]:nil;
- one["wl_auth_modes"] = resource["wlan", 0, "auth_modes"]:nil;
- one["wl_enc_modes"] = resource["wlan", 0, "enc_modes"]:nil;
- }
-
- y2debug("found device: %1", one);
- if (card_ok) {
- Hardware[size(Hardware)] = one;
- num = num + 1;
- }
- else {
- y2milestone ("Filtering out: %1", card);
- }
- });
-
- /* if there is wlan, put it to the front of the list */
- // that's because we want it proposed and currently only one card
- // can be proposed
- boolean found = false;
- integer i = 0;
- foreach (map h, Hardware, {
- if (h["type"]:"" == "wlan")
- {
- found = true;
- break;
- }
- i = i + 1;
- });
- if (found)
- {
- map temp = Hardware[0]:$[];
- Hardware[0] = Hardware[i]:$[];
- Hardware[i] = temp;
- // adjust mapping: #98852, #102945
- Hardware[0, "num"] = 0;
- Hardware[i, "num"] = i;
- }
-
- y2debug("Hardware=%1", Hardware);
- return Hardware;
-}
+include "network/routines.ycp";
/**
* Select the given hardware item or clean up structures (item == nil)
@@ -427,6 +66,17 @@
return sel;
}
+
+/**
+ * Select the given hardware item or clean up structures (item == nil)
+ * @param which item to be chosen
+ */
+map SelectHardware (list Hardware, integer which) {
+ return SelectHardwareMap (FindHardware (Hardware, which));
+}
+
+
+
/* modem * /
if(type == "modem") {
Init1 = sel["init1"]:"";
@@ -463,42 +113,7 @@
}
*/
-/**
- * Select the given hardware item or clean up structures (item == nil)
- * @param which item to be chosen
- */
-map SelectHardware (list Hardware, integer which) {
- return SelectHardwareMap (FindHardware (Hardware, which));
-}
-
-import "NetworkModules";
-include "network/routines.ycp";
-
-
-string createHwcfgName(map hw){
- string hwcfg_name = "";
- // name of hwcfg
- if(hasAnyValue(hw["busid"]:"")) {
- // #208854 - include "static" string
- if(issubstring(hw["sysfs_id"]:"", "pnp")){
- hwcfg_name = "static-bus-" + hw["bus"]:"" + "-" + hw["busid"]:"";
- }
- else{
- hwcfg_name = "bus-" + hw["bus"]:"" + "-" + hw["busid"]:"";
- if(Arch::s390 ()) hwcfg_name = DriverType(type) + "-" + hwcfg_name;
- }
- }
- else {
- // #suse42421 - don't write hwcfg-static for pcmcia cards (PC and CardBus)
- // #254753 - when busID not available, use static-x hwcfg filename
- if(Arch::s390 ()) {
- hwcfg_name = NetworkModules::GetFreeName("static-");
- y2internal("No bus id info found, will use %1", hwcfg_name);
- } else y2warning ("No bus id info found, skipping hwcfg: %1", hw);
- }
- return hwcfg_name;
-}
/* EOF */
Modified: trunk/network/src/routines/routines.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/routines/routines.yc…
==============================================================================
--- trunk/network/src/routines/routines.ycp (original)
+++ trunk/network/src/routines/routines.ycp Mon Jul 2 16:53:49 2007
@@ -15,6 +15,13 @@
import "Popup";
import "Progress";
import "String";
+import "NetworkService";
+import "PackageSystem";
+import "NetworkDevices";
+import "Arch";
+import "NetworkModules";
+import "Confirm";
+import "Map";
/**
* Abort function
@@ -346,5 +353,447 @@
}
+map<string, any> getcfg(string options, string device){
+ map <string, any> cfg=$[];
+ map <string, any> output = (map <string, any>)SCR::Execute(.target.bash_output,
+ sformat("getcfg %1 %2", options, device));
+ foreach(string row, splitstring(output["stdout"]:"", "\n"), {
+ row=deletechars(row, "\\\"\;");
+ list<string> keyval=splitstring(row, "=");
+ if (size(keyval)>1) cfg[keyval[0]:""]=keyval[1]:"";
+
+ });
+ y2milestone("%1 %2\n%3", options, device, cfg);
+ return cfg;
+}
+
+map getHardware(string sysfs_id, list<map> Hw){
+ map hardware = $[];
+ foreach(map hw_temp, Hw, {
+ if (sysfs_id == sformat("/sys%1", hw_temp["sysfs_id"]:"")) hardware = hw_temp;
+ });
+ return hardware;
+}
+
+boolean CheckNetworkManagerPlugin(){
+ if (NetworkService::IsManaged()){
+ y2milestone("Check what package is needed to configure NetworkManager");
+ string nmp = ((string)SCR::Read(.sysconfig.windowmanager.DEFAULT_WM)=="kde")?"NetworkManager-kde":"NetworkManager-gnome";
+ y2milestone("Test for %1 if installed", nmp);
+ PackageSystem::CheckAndInstallPackages([nmp]);
+ }
+ return true;
+}
+
+string getIfcName(string hwfile, string devicename){
+ string ifcfg="";
+ string interfacetype = NetworkDevices::device_type( devicename );
+ // for special s390 interface types write static configuration
+ if (contains(["qeth", "hsi", "ctc", "lcs", "iucv"], interfacetype)){
+ y2internal("special device type %1", interfacetype);
+ ifcfg=sformat("ifcfg-%1", hwfile);
+ } else {
+ y2internal("usual type %1", interfacetype);
+ // if MAC available - use it for name
+// if (size(hwcfg["HWD_ID"]:"")>0){
+// ifcfg = sformat("ifcfg-%1-id-%2", interfacetype, hwcfg["HWD_ID"]:"");
+// y2internal("MAC address available - use it for name %1", ifcfg);
+// } else {
+ // in case MAC is not available, use device name (eth0)
+ ifcfg = sformat("ifcfg-%1", devicename );
+// y2internal("MAC address not available - use device name %1", ifcfg);
+// }
+ }
+ y2internal("interface configuration file %1", ifcfg);
+ return ifcfg;
+}
+
+
+string createHwcfgName(map hw, string type){
+ string hwcfg_name = "";
+ // name of hwcfg
+ if(hasAnyValue(hw["busid"]:"")) {
+ // #208854 - include "static" string
+ if(issubstring(hw["sysfs_id"]:"", "pnp")){
+ hwcfg_name = "static-bus-" + hw["bus"]:"" + "-" + hw["busid"]:"";
+ }
+ else{
+ hwcfg_name = "bus-" + hw["bus"]:"" + "-" + hw["busid"]:"";
+ if(Arch::s390 ()) hwcfg_name = DriverType(type) + "-" + hwcfg_name;
+ }
+ }
+ else {
+ // #suse42421 - don't write hwcfg-static for pcmcia cards (PC and CardBus)
+ // #254753 - when busID not available, use static-x hwcfg filename
+ if(Arch::s390 ()) {
+ hwcfg_name = NetworkModules::GetFreeName("static-");
+ y2internal("No bus id info found, will use %1", hwcfg_name);
+ } else y2warning ("No bus id info found, skipping hwcfg: %1", hw);
+ }
+ return hwcfg_name;
+}
+
+define string DistinguishedName(string name, map hwdevice) {
+ if(hwdevice["sysfs_bus_id"]:"" != "")
+ return sformat("%1 (%2)", name, hwdevice["sysfs_bus_id"]:"");
+ return name;
+}
+
+/**
+ * Extract the device 'name'
+ * @param hwdevice hardware device
+ * @return name consisting of vendor and device name
+ */
+define string DeviceName(map hwdevice) {
+ string delimiter = " "; // "\n";
+ string model = "";
+ string vendor = "";
+ string dev = "";
+
+ model = hwdevice["model"]:"";
+ if(model != "" && model != nil) return model;
+
+ vendor = hwdevice["sub_vendor"]:"";
+ dev = hwdevice["sub_device"]:"";
+
+ if((vendor == "") || (dev == "")) {
+ vendor = hwdevice["vendor"]:"";
+ dev = hwdevice["device"]:"";
+ }
+
+ if(vendor != "")
+ return vendor + delimiter + dev;
+ else
+ return dev;
+}
+
+/**
+ * Simple convertor from subclass to controller type.
+ * @param hwdevice map with card info containing "subclass"
+ * @return short device name
+ * @example ControllerType(<ethernet controller map>) -> "eth"
+ */
+define string ControllerType(map hwdevice) {
+
+ if(hwdevice["subclass"]:"" == "Modem") return "modem";
+ if(hwdevice["subclass"]:"" == "ISDN") return "isdn";
+ if(hwdevice["subclass"]:"" == "DSL") return "dsl";
+
+ integer subclass_id = hwdevice["sub_class_id"]:-1;
+
+ /* Network controller */
+ if(hwdevice["class_id"]:-1 == 2) {
+ if(subclass_id == 0) return "eth";
+ else if(subclass_id == 1) return "tr";
+ else if(subclass_id == 2) return "fddi";
+ else if(subclass_id == 3) return "atm";
+ else if(subclass_id == 4) return "isdn";
+ else if(subclass_id == 0x81) return "myri";
+ else if(subclass_id == 0x82) return "wlan";
+ else if(subclass_id == 0x83) return "xp";
+ else if(subclass_id == 0x86) return "qeth";
+ else if(subclass_id == 0x87) return "hsi";
+ else if(subclass_id == 0x88) return "ctc";
+ else if(subclass_id == 0x89) return "lcs";
+ else if(subclass_id == 0x8E) return "ficon";
+ else if(subclass_id == 0x8F) return "escon";
+ else if(subclass_id == 0x90) return "iucv";
+ else if(subclass_id == 0x91) return "usb"; // #22739
+ else if(subclass_id == 0x80) {
+ /* Nothing was found */
+ y2error("Unknown network controller type: %1", hwdevice);
+ y2error("It's probably missing in hwinfo (NOT src/hd/hd.h:sc_net_if)");
+ return "";
+ }
+ else {
+ /* Nothing was found */
+ y2error("Unknown network controller type: %1", hwdevice);
+ return "";
+ }
+
+ }
+ /* Communication controller */
+ if(hwdevice["class_id"]:-1 == 7) {
+ if(subclass_id == 3) return "modem";
+ else if(subclass_id == 0x80) {
+ /* Nothing was found */
+ y2error("Unknown network controller type: %1", hwdevice);
+ y2error("It's probably missing in hwinfo (src/hd/hd.h:sc_net_if)");
+ return "";
+ }
+ else {
+ /* Nothing was found */
+ y2error("Unknown network controller type: %1", hwdevice);
+ return "";
+ }
+
+ }
+ /* Network Interface */
+ // check the CVS history and then kill this code!
+ // 0x107 is the output of hwinfo --network
+ // which lists the INTERFACES
+ // but we are inteested in hwinfo --netcard
+ // Just make sure that hwinfo or ag_probe
+ // indeed does not pass this to us
+ else if(hwdevice["class_id"]:-1 == 0x107) {
+ y2milestone ("CLASS 0x107"); // this should happen rarely
+ if(subclass_id == 0) return "lo";
+ else if(subclass_id == 1) return "eth";
+ else if(subclass_id == 2) return "tr";
+ else if(subclass_id == 3) return "fddi";
+ else if(subclass_id == 4) return "ctc";
+ else if(subclass_id == 5) return "iucv";
+ else if(subclass_id == 6) return "hsi";
+ else if(subclass_id == 7) return "qeth";
+ else if(subclass_id == 8) return "escon";
+ else if(subclass_id == 9) return "myri";
+ else if(subclass_id == 10) return "wlan";
+ else if(subclass_id == 11) return "xp";
+ else if(subclass_id == 12) return "usb";
+ else if(subclass_id == 0x80) {
+ /* Nothing was found */
+ y2error("Unknown network interface type: %1", hwdevice);
+ y2error("It's probably missing in hwinfo (src/hd/hd.h:sc_net_if)");
+ return "";
+ }
+ else if(subclass_id == 0x81) return "sit";
+ else {
+ /* Nothing was found */
+ y2error("Unknown network interface type: %1", hwdevice);
+ return "";
+ }
+ }
+ else if(hwdevice["class_id"]:-1 == 0x102)
+ return "modem";
+ else if(hwdevice["class_id"]:-1 == 0x103)
+ return "isdn";
+ else if(hwdevice["class_id"]:-1 == 0x114)
+ return "dsl";
+
+ /* Nothing was found */
+ y2error("Unknown controller type: %1", hwdevice);
+ return "";
+}
+
+/**
+ * Read HW information
+ * @param hwtype type of devices to read (netcard|modem|isdn)
+ * @return true if success
+ */
+define list<map> ReadHardware(string hwtype) {
+ list<map> Hardware = [];
+
+ y2debug("hwtype=%1", hwtype);
+
+ integer num = 0;
+ list paths = [];
+ list allcards = [];
+
+ map<string,path> hwtypes = $[
+ "netcard" : .probe.netcard,
+ "modem" : .probe.modem,
+ "isdn" : .probe.isdn,
+ "dsl" : .probe.dsl,
+ ];
+
+ map<string,string> hwstrings = $[
+ /* Confirmation: label text (detecting hardware: xxx) */
+ "netcard" : _("Network Cards"),
+ /* Confirmation: label text (detecting hardware: xxx) */
+ "modem" : _("Modems"),
+ /* Confirmation: label text (detecting hardware: xxx) */
+ "isdn" : _("ISDN Cards"),
+ /* Confirmation: label text (detecting hardware: xxx) */
+ "dsl" : _("DSL Devices"),
+ ];
+
+ /* Confirmation: label text (detecting hardware: xxx) */
+ string hwstring = _("All Network Devices");
+ if(haskey(hwstrings, hwtype)) hwstring = hwstrings[hwtype]:"";
+ if(!Confirm::Detection(hwstring)) return [];
+
+ /* read the corresponding hardware */
+ if(haskey(hwtypes, hwtype))
+ allcards = (list) SCR::Read(hwtypes[hwtype]:nil);
+ else if(hwtype == "all" || hwtype == "" || hwtype == nil)
+ maplist(path v, (list<path>) Map::Values(hwtypes), {
+ allcards = merge(allcards, (list) SCR::Read(v));
+ });
+ else {
+ y2error("unknown hwtype: %1", hwtype);
+ return [];
+ }
+
+ if(allcards == nil) {
+ y2error("hardware detection failure");
+ allcards = [];
+ }
+
+ // #97540
+ string bms = (string)SCR::Read (.etc.install_inf.BrokenModules);
+ if (bms == nil) bms = "";
+ list<string> broken_modules = splitstring (bms, " ");
+
+ /* fill in the hardware data */
+ maplist(map card, (list<map>) allcards, {
+ map one = $[];
+
+ /* common stuff */
+ map resource = card["resource"]:$[];
+ string controller = ControllerType(card);
+ boolean card_ok = controller != "";
+ one["name"] = DeviceName(card);
+ one["type"] = controller;
+ one["udi"] = card["udi"]:"";
+ one["sysfs_id"] = card["sysfs_id"]:"";
+ one["dev_name"] = card["dev_name"]:"";
+ one["requires"] = card["requires"]:[];
+ // Each card remembers its position in the list of _all_ cards.
+ // It is used when selecting the card from the list of _unconfigured_
+ // ones (which may be smaller). #102945.
+ one["num"] = num;
+
+ /* Temporary solution for s390: #40587 */
+ if(Arch::s390 ()) one["name"] = DistinguishedName(one["name"]:"", card);
+
+ /* modem */
+ if(controller == "modem") {
+ one["device_name"] = card["dev_name"]:"";
+ one["drivers"] = card["drivers"]:[];
+ integer speed = resource["baud", 0, "speed"]:57600;
+ // :-) have to check .probe and libhd if this confusion is
+ // really necessary. maybe a pppd bug too? #148893
+ if (speed == 12000000)
+ {
+ speed = 57600;
+ y2milestone ("Driving faster than light is prohibited on this planet.");
+ }
+ one["speed"] = speed;
+ one["init1"] = resource["init_strings", 0, "init1"]:"";
+ one["init2"] = resource["init_strings", 0, "init2"]:"";
+ one["pppd_options"] = resource["pppd_option", 0, "option"]:"";
+ }
+ /* isdn card */
+ else if(controller == "isdn") {
+ list drivers = card["isdn"]:[];
+ one["drivers"] = drivers;
+ one["sel_drv"] = 0;
+ one["bus"] = card["bus"]:"";
+ one["io"] = resource["io", 0, "start"]:0;
+ one["irq"] = resource["irq", 0, "irq"]:0;
+ }
+ /* dsl card */
+ else if(controller == "dsl") {
+ map driver_info = card["dsl", 0]:$[];
+ map<string, string> translate_mode = $[
+ "capiadsl": "capi-adsl",
+ "pppoe": "pppoe",
+ ];
+ string m = driver_info["mode"]:"";
+ one["pppmode"] = translate_mode[m]:m;
+ // driver_info["name"]:"" has no use here??
+ }
+ /* treat the rest as a network card */
+ else if(controller != "") {
+ // drivers:
+ // Although normally there is only one module
+ // (one=$[active:, module:, options:,...]), the generic
+ // situation is: one or more driver variants (exclusive),
+ // each having one or more modules (one[drivers])
+
+ // only drivers that are not marked as broken (#97540)
+ list drivers = filter (map d, (list<map>) card["drivers"]:[], {
+ // ignoring more modules per driver...
+ list module0 = d["modules", 0]:[]; // [module, options]
+ boolean brk = contains (broken_modules, module0[0]:"");
+ if (brk)
+ {
+ y2milestone ("In BrokenModules, skipping: %1", module0);
+ }
+ return !brk;
+ });
+
+ if (drivers == [])
+ {
+ y2milestone ("No good drivers found");
+ // #153235
+ // fail, unless we are in xen (it has the driver built in)
+ card_ok = Arch::is_xenU ();
+ }
+ else
+ {
+ one["drivers"] = drivers;
+
+ map driver = drivers[0]:$[];
+ one["active"] = driver["active"]:false;
+ list module0 = driver["modules", 0]:[]; // [module, options]
+ one["module"] = module0[0]:"";
+ one["options"] = module0[1]:"";
+ }
+
+ /* FIXME: this should be also done for modems and others */
+ /* FIXME: #13571 */
+ string hp = card["hotplug"]:"";
+ if(hp == "pcmcia" || hp == "cardbus")
+ one["hotplug"] = "pcmcia";
+ else if(hp == "usb")
+ one["hotplug"] = "usb";
+
+ /* store the BUS type */
+ string bus = card["bus_hwcfg"]:(card["bus"]:"");
+ if(bus == "PCI") bus = "pci";
+ else if(bus == "USB") bus = "usb";
+ else if(bus == "Virtual IO") bus = "vio";
+ one["bus"] = bus;
+
+ one["busid"] = card["sysfs_bus_id"]:"";
+ one["mac"] = resource["hwaddr", 0, "addr"]:"";
+ // is the cable plugged in? nil = don't know
+ one["link"] = resource["link", 0, "state"]:nil;
+
+ // Wireless Card Features
+ one["wl_channels"] = resource["wlan", 0, "channels"]:nil;
+ //one["wl_frequencies"] = resource["wlan", 0, "frequencies"]:nil;
+ one["wl_bitrates"] = resource["wlan", 0, "bitrates"]:nil;
+ one["wl_auth_modes"] = resource["wlan", 0, "auth_modes"]:nil;
+ one["wl_enc_modes"] = resource["wlan", 0, "enc_modes"]:nil;
+ }
+
+ y2debug("found device: %1", one);
+ if (card_ok) {
+ Hardware[size(Hardware)] = one;
+ num = num + 1;
+ }
+ else {
+ y2milestone ("Filtering out: %1", card);
+ }
+ });
+
+ /* if there is wlan, put it to the front of the list */
+ // that's because we want it proposed and currently only one card
+ // can be proposed
+ boolean found = false;
+ integer i = 0;
+ foreach (map h, Hardware, {
+ if (h["type"]:"" == "wlan")
+ {
+ found = true;
+ break;
+ }
+ i = i + 1;
+ });
+ if (found)
+ {
+ map temp = Hardware[0]:$[];
+ Hardware[0] = Hardware[i]:$[];
+ Hardware[i] = temp;
+ // adjust mapping: #98852, #102945
+ Hardware[0, "num"] = 0;
+ Hardware[i, "num"] = i;
+ }
+
+ y2debug("Hardware=%1", Hardware);
+ return Hardware;
+}
/* EOF */
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r39110 - /branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.cc
by sh-sh-sh@svn.opensuse.org 02 Jul '07
by sh-sh-sh@svn.opensuse.org 02 Jul '07
02 Jul '07
Author: sh-sh-sh
Date: Mon Jul 2 16:43:38 2007
New Revision: 39110
URL: http://svn.opensuse.org/viewcvs/yast?rev=39110&view=rev
Log:
don't complain about self
Modified:
branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.cc
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.cc Mon Jul 2 16:43:38 2007
@@ -169,7 +169,7 @@
// expensive. But then, this is a bug in that application that needs to
// be fixed.
- if ( oldSelectedItem )
+ if ( oldSelectedItem && oldSelectedItem != item )
{
oldSelectedItem->setSelected( false );
y2warning( "Enforcing single selection: Deselecting %s",
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r39109 - /branches/tmp/sh/mod-ui/core/libyui/src/YComboBox.h
by sh-sh-sh@svn.opensuse.org 02 Jul '07
by sh-sh-sh@svn.opensuse.org 02 Jul '07
02 Jul '07
Author: sh-sh-sh
Date: Mon Jul 2 16:36:21 2007
New Revision: 39109
URL: http://svn.opensuse.org/viewcvs/yast?rev=39109&view=rev
Log:
style
Modified:
branches/tmp/sh/mod-ui/core/libyui/src/YComboBox.h
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YComboBox.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YComboBox.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YComboBox.h Mon Jul 2 16:36:21 2007
@@ -224,7 +224,6 @@
* Called internally whenever the content is to change
* programmatically. Don't call setValue() or selectItem() from here.
*
- *
* Derived classes are required to implement this function.
**/
virtual void setText( const string & newText ) = 0;
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0