Bug#611250: please support network bonding

2014-11-08 Thread Michal Humpula
Tags: patch

new versiondiff --git a/Makefile b/Makefile
index 70c0e2c..911abc6 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@ TARGETS		?= netcfg-static netcfg
 
 LDOPTS		= -ldebconfclient -ldebian-installer
 CFLAGS		= -W -Wall -Werror -DNDEBUG -DNETCFG_VERSION=\$(NETCFG_VERSION)\ -DNETCFG_BUILD_DATE=\$(NETCFG_BUILD_DATE)\ -I.
-COMMON_OBJS	= netcfg-common.o wireless.o write_interface.o ipv6.o
+COMMON_OBJS	= netcfg-common.o wireless.o write_interface.o ipv6.o bond.o
 NETCFG_O   	= netcfg.o dhcp.o static.o ethtool-lite.o wpa.o wpa_ctrl.o rdnssd.o autoconfig.o
 NETCFG_STATIC_O	= netcfg-static.o static.o ethtool-lite.o
 
diff --git a/bond.c b/bond.c
new file mode 100644
index 000..ffeb744
--- /dev/null
+++ b/bond.c
@@ -0,0 +1,104 @@
+/*
+ * bond.c - Bonding configuration for debian-installer
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#include netcfg.h
+#include debian-installer.h
+
+int netcfg_configure_bonding(struct debconfclient *client, char **interface)
+{
+FILE *fp;
+
+debconf_get(client, netcfg/bonding);
+if (strlen(client-value) == 0) {
+return 0;
+}
+
+char *bonding_iface = strdup(client-value);
+
+char *mode = 0;
+debconf_get(client, netcfg/bonding_mode);
+
+if (strcmp(client-value, balance-rr) == 0 || strcmp(client-value, 0) == 0) {
+mode = 0;
+} else if (strcmp(client-value, active-backup) == 0 || strcmp(client-value, 1) == 0) {
+mode = 1;
+} else if (strcmp(client-value, balance-xor) == 0 || strcmp(client-value, 2) == 0) {
+mode = 2;
+} else if (strcmp(client-value, broadcast) == 0 || strcmp(client-value, 3) == 0) {
+mode = 3;
+} else if (strcmp(client-value, 802.3ad) == 0 || strcmp(client-value, 4) == 0) {
+mode = 4;
+} else if (strcmp(client-value, balance-tlb) == 0 || strcmp(client-value, 5) == 0) {
+mode = 5;
+} else if (strcmp(client-value, balance-alb) == 0 || strcmp(client-value, 6) == 0) {
+mode = 6;
+}
+
+debconf_get(client, netcfg/bonding_slaves);
+char *slaves;
+
+if (strlen(client-value)  2) {
+slaves = strdup(*interface);
+} else {
+slaves = strdup(client-value);
+}
+
+di_info(Creating bonding %s with mode=%s, slaves=%s, bonding_iface, mode, slaves);
+
+char cmd[200];
+snprintf(cmd, sizeof(cmd), modprobe bonding mode=%s miimon=100 max_bonds=0, mode);
+
+if (di_exec_shell_log(cmd)) {
+di_error(Could not modprobe bonding module);
+free(bonding_iface);
+free(slaves);
+return 1;
+}
+
+if ((fp = file_open(/sys/class/net/bonding_masters, w))) {
+  fprintf(fp, +%s, bonding_iface);
+  fclose(fp);
+}
+
+char sysfs_path[100];
+snprintf(sysfs_path, sizeof(sysfs_path), /sys/class/net/%s/bonding/slaves, bonding_iface);
+
+char *rest, *slave, *ptr = slaves;
+
+while((slave = strtok_r(ptr,  ,, rest)) != NULL) {
+ptr = rest;
+snprintf(cmd, sizeof(cmd), ip link set %s down, slave);
+di_exec_shell_log(cmd);
+
+
+if ((fp = file_open(sysfs_path, w))) {
+fprintf(fp, +%s, slave);
+fclose(fp);
+}
+}
+
+snprintf(cmd, sizeof(cmd), ip link set %s up, bonding_iface);
+di_exec_shell_log(cmd);
+
+free(slaves);
+free(*interface);
+*interface = bonding_iface;
+
+return 0;
+}
diff --git a/debian/netcfg-common.templates b/debian/netcfg-common.templates
index 4525305..ec75376 100644
--- a/debian/netcfg-common.templates
+++ b/debian/netcfg-common.templates
@@ -371,3 +371,18 @@ _Choices: ${essid_list} Enter ESSID manually
 _Description: Wireless network:
  Select the wireless network to use during the installation process.
 
+Template: netcfg/bonding
+Type: string
+Description: for internal use; can be preseeded
+ Configure bonding interface
+
+Template: netcfg/bonding_mode
+Type: string
+Default: balance-rr
+Description: for internal use; can be preseeded
+ Configure bonding interface mode
+
+Template: netcfg/bonding_slaves
+Type: string
+Description: for internal use; can be preseeded
+ Configure bonding slaves (detected interface by default)
diff --git a/netcfg.c b/netcfg.c
index e544e61..311c90f 100644
--- a/netcfg.c
+++ b/netcfg.c
@@ -219,9 +219,11 @@ int main(int argc, char *argv[])
 

Bug#611250: please support network bonding

2014-11-08 Thread Michael Tokarev
Maybe it is really better to postprone bonding configuration until
past installation?  As far as I understand, bonding is entirely
optional and is intended to make network faster and more reliable.
It is not exactly necessary during install, and can be made later.
But more feature makes d-i complex for both developers and users...

Thanks,

/mjt


-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/545dfbdd.8060...@msgid.tls.msk.ru



Bug#611250: please support network bonding

2014-11-08 Thread Ben Hutchings
On Sat, 2014-11-08 at 14:17 +0300, Michael Tokarev wrote:
 Maybe it is really better to postprone bonding configuration until
 past installation?  As far as I understand, bonding is entirely
 optional and is intended to make network faster and more reliable.
 It is not exactly necessary during install, and can be made later.
 But more feature makes d-i complex for both developers and users...

If the bond uses the IEEE 802.1ax protocol (fka IEEE 802.3ad) then you
cannot use it without sending and receiving some configuration packets.

Ben.

-- 
Ben Hutchings
Time is nature's way of making sure that everything doesn't happen at once.


signature.asc
Description: This is a digitally signed message part


Bug#611250: please support network bonding

2011-01-27 Thread Martin Zobel-Helas
Package: netcfg
Severity: wishlist
Tags: d-i

Hi,

it would be nice if the debian-installer could support network bonding
on several interfaces. This will probably need additional questions
during the installation process:

* slave interfaces
* bonding mode
  + balance-rr
  + active-backup
  + balance-xor
  + broadcast
  + 802.3ad
  + balance-tlb
  + balance-alb
* Link check interval (maybe with a reasonable default)

Bonus points, if this later can then also be combined with vlan support,
so i can haz bond0.330 :)


Cheers,
Martin

-- System Information:
Debian Release: 6.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

-- 
 Martin Zobel-Helas zo...@debian.org  | Debian System Administrator
 Debian  GNU/Linux Developer   |   Debian Listmaster
 Public key http://zobel.ftbfs.de/5d64f870.asc   -   KeyID: 5D64 F870
 GPG Fingerprint:  5DB3 1301 375A A50F 07E7  302F 493E FB8E 5D64 F870



-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20110127110322.ga32...@ftbfs.de



Bug#611250: please support network bonding

2011-01-27 Thread Ferenc Wagner
Martin Zobel-Helas zo...@debian.org writes:

 it would be nice if the debian-installer could support network bonding
 on several interfaces.

Why do you think it's worth the effort?  Installation isn't performance
critical, nor does it require high availability.  And you can easily
configure bonding after installation.  So I'm not sure it's worth the
added complexity.  (I'm saying this although I routinely write out
bonding-enabled /etc/network/interfaces from a finish.d script... :)
-- 
Regards,
Feri.



-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/877hdqtu6y@tac.ki.iif.hu



Bug#611250: please support network bonding

2011-01-27 Thread Martin Zobel-Helas
Hi, 

On Thu Jan 27, 2011 at 13:19:49 +0100, Ferenc Wagner wrote:
 Martin Zobel-Helas zo...@debian.org writes:
 
  it would be nice if the debian-installer could support network bonding
  on several interfaces.
 
 Why do you think it's worth the effort?  Installation isn't performance
 critical, nor does it require high availability.  And you can easily
 configure bonding after installation.  So I'm not sure it's worth the
 added complexity.  (I'm saying this although I routinely write out
 bonding-enabled /etc/network/interfaces from a finish.d script... :)

I installed Debian quite often recently in an existing environment, and
actually, using balancing mode, you everytime need to reconfigure the
switch to not route every second package to the interface not being
available in the installer. That is kind of boring, and my idea is,
Debian could do better.


Cheers,
Martin
-- 
 Martin Zobel-Helas zo...@debian.org  | Debian System Administrator
 Debian  GNU/Linux Developer   |   Debian Listmaster
 Public key http://zobel.ftbfs.de/5d64f870.asc   -   KeyID: 5D64 F870
 GPG Fingerprint:  5DB3 1301 375A A50F 07E7  302F 493E FB8E 5D64 F870




-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20110127131852.gh13...@ftbfs.de



Bug#611250: please support network bonding

2011-01-27 Thread Ferenc Wagner
Martin Zobel-Helas zo...@debian.org writes:

 On Thu Jan 27, 2011 at 13:19:49 +0100, Ferenc Wagner wrote:

 Martin Zobel-Helas zo...@debian.org writes:
 
 it would be nice if the debian-installer could support network bonding
 on several interfaces.
 
 Why do you think it's worth the effort?  Installation isn't performance
 critical, nor does it require high availability.  And you can easily
 configure bonding after installation.  So I'm not sure it's worth the
 added complexity.  (I'm saying this although I routinely write out
 bonding-enabled /etc/network/interfaces from a finish.d script... :)

 I installed Debian quite often recently in an existing environment, and
 actually, using balancing mode, you everytime need to reconfigure the
 switch to not route every second package to the interface not being
 available in the installer. That is kind of boring, and my idea is,
 Debian could do better.

Fascinating.  Why is the other interface up at all?  Or does the switch
simply not care?

Anyway, I'm certainly not against this, but d-i has traditionally been
rather wary about growing new features.  That said, bonding doesn't
require extra utilities (being fully configurable through sysfs), so
this probably isn't a serious issue.
-- 
Cheers,
Feri.



-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/87wrlqsbsk@tac.ki.iif.hu



Bug#611250: please support network bonding

2011-01-27 Thread Matthew Palmer
tag 611250 +help
tag 611250 +wontfix
thanks

On Thu, Jan 27, 2011 at 12:03:23PM +0100, Martin Zobel-Helas wrote:
 it would be nice if the debian-installer could support network bonding
 on several interfaces.

I'm with Ferenc on this; bonding isn't necessary to install the system, so
I'm loathe to put it into d-i.  In particular:

 This will probably need additional questions during the installation
 process:

This makes it a UI nightmare if all those questions are asked[1]; even if
it's only preseedable, it's still a pain in the arse.

To address your later concerns, if your switch is dumb enough to send
packets down a link that's down, fix your switch.  If your NIC/driver tells
the switch that the link is up when it's administratively down, fix your
NIC/driver.  If netcfg is leaving interfaces administratively up when the
system isn't using them, report an appropriately detailed bug and I'll look
into it.

All that being said, if a patch were to turn up on this bug that handled all
the questions in a preseed-only fashion, integrated well with the rest of
the netcfg code (it might be better to wait 3 months on that one; I'm
currently refactoring all the internals to make extensions like this a lot
easier to integrate), I would give it a fair assessment with a view to
merging it.

- Matt

[1] Yes, I'm well aware that most of them would be hidden behind a do you
want to bond interfaces?, but even asking that question would be
problematic for the vast majority of users to answer; I'm not a personal fan
of lower priority to hide this sort of thing either, because then you
bombard the advanced user with piles of questions they just don't want to
see from other packages.



-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20110127195904.gb3...@hezmatt.org



Processed: Re: Bug#611250: please support network bonding

2011-01-27 Thread Debian Bug Tracking System
Processing commands for cont...@bugs.debian.org:

 tag 611250 +help
Bug #611250 [netcfg] please support network bonding
Added tag(s) help.
 tag 611250 +wontfix
Bug #611250 [netcfg] please support network bonding
Added tag(s) wontfix.
 thanks
Stopping processing here.

Please contact me if you need assistance.
-- 
611250: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=611250
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems


-- 
To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/handler.s.c.129616721517065.transcr...@bugs.debian.org