Bug#694965: netcfg: Allow setup of pointopoint routes to reach gateway

2018-06-12 Thread Igor Scheller
Oh, and here is the patch File ;)

On 12.06.2018 13:49, Igor Scheller wrote:
> Hi,
> i created a merge request [1] that allows to preseed pointopoint
> connections so anyone can use a preseed file or boot parameters to
> define a pointopoint connection.
> -> If a pointopoint connection is preseeded it would be used.
>
> Improvements / thoughts welcome!
>
> Greets
> Igor Scheller
>
>
> [1] https://salsa.debian.org/installer-team/netcfg/merge_requests/2
From 06647bebad8643a1990a98431bfdc4eab80007d8 Mon Sep 17 00:00:00 2001
From: Igor Scheller 
Date: Sat, 2 Jun 2018 17:24:30 +0200
Subject: [PATCH 1/2] Add support for preseeded pointopoint

---
 static.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/static.c b/static.c
index ea12fba4..316f8d8e 100644
--- a/static.c
+++ b/static.c
@@ -557,11 +557,13 @@ int netcfg_get_static(struct debconfclient *client, struct netcfg_interface *ifa
 if (netcfg_get_ipaddress (client, iface)) {
 state = BACKUP;
 } else {
+debconf_get(client, "netcfg/get_pointopoint");
 if (strncmp(iface->name, "plip", 4) == 0
 || strncmp(iface->name, "slip", 4) == 0
 || strncmp(iface->name, "ctc", 3) == 0
 || strncmp(iface->name, "escon", 5) == 0
-|| strncmp(iface->name, "iucv", 4) == 0)
+|| strncmp(iface->name, "iucv", 4) == 0
+|| !empty_str(client->value))
 state = GET_POINTOPOINT;
 else if (iface->masklen == 0) {
 state = GET_NETMASK;
-- 
2.17.1


From 258e0a104c3207ecb723103446c686ad57181f7e Mon Sep 17 00:00:00 2001
From: Igor Scheller 
Date: Tue, 12 Jun 2018 13:12:38 +0200
Subject: [PATCH 2/2] Preseeded pointopoint: Fix routing

---
 static.c  | 2 +-
 write_interface.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/static.c b/static.c
index 316f8d8e..e3d93c79 100644
--- a/static.c
+++ b/static.c
@@ -368,7 +368,7 @@ static int netcfg_activate_static_ipv4(struct debconfclient *client,
 
 if (!empty_str(interface->pointopoint))
 {
-snprintf(buf, sizeof(buf), "ip route add default dev %s", interface->name);
+snprintf(buf, sizeof(buf), "ip route add default via %s dev %s", interface->pointopoint, interface->name);
 rv |= di_exec_shell_log(buf);
 }
 else if (!empty_str(interface->gateway)) {
diff --git a/write_interface.c b/write_interface.c
index 1f683b2a..406513e6 100644
--- a/write_interface.c
+++ b/write_interface.c
@@ -120,7 +120,7 @@ static int nc_wi_static_ipv4(const struct netcfg_interface *interface, FILE *fd)
 	fprintf(fd, "iface %s inet static\n", interface->name);
 	fprintf(fd, "\taddress %s/%i\n", interface->ipaddress,
 	empty_str(interface->pointopoint) ? interface->masklen : 32);
-	if (!empty_str(interface->gateway))
+	if (!empty_str(interface->gateway) || !empty_str(interface->pointopoint))
 		fprintf(fd, "\tgateway %s\n",
 		empty_str(interface->pointopoint) ? interface->gateway : interface->pointopoint);
 	if (!empty_str(interface->pointopoint))
-- 
2.17.1



signature.asc
Description: OpenPGP digital signature


Bug#694965: netcfg: Allow setup of pointopoint routes to reach gateway

2018-06-12 Thread Igor Scheller
Hi,
i created a merge request [1] that allows to preseed pointopoint
connections so anyone can use a preseed file or boot parameters to
define a pointopoint connection.
-> If a pointopoint connection is preseeded it would be used.

Improvements / thoughts welcome!

Greets
Igor Scheller


[1] https://salsa.debian.org/installer-team/netcfg/merge_requests/2




signature.asc
Description: OpenPGP digital signature


Bug#694965: netcfg: Allow setup of pointopoint routes to reach gateway

2012-12-04 Thread Philipp Kern
On Tue, Dec 04, 2012 at 07:49:07AM +0100, Michael Neuffer wrote:
> >Well, it's only triggered for known point-to-point devices:
> >
> > if (strncmp(iface->name, "plip", 4) == 0
> > || strncmp(iface->name, "slip", 4) == 0
> > || strncmp(iface->name, "ctc", 3) == 0
> > || strncmp(iface->name, "escon", 5) == 0
> > || strncmp(iface->name, "iucv", 4) == 0)
> > state = GET_POINTOPOINT;
> Then   || strncmp(iface->name, "eth", 3) == 0
> is missing.

No it's not. We don't want everybody to get asked.

> >I don't think it makes sense to ask it at any default priority value.
> >We might ask it at "low" but in any case the real use of that option
> >should be through preseeding for devices other than the ones listed
> >above.
> Not true. This case will become more and more common with the
> current state of IPv4.
> 
> And besides, how do you set the priority if you are not in expert mode?
> Or how is a normal user supposed to use preseeding?

"low" would need expert mode. A normal user can use preseeding by editing
the boot parameters or by using virt-install etc.; there are various
ways that are documented.

Kind regards
Philipp Kern


signature.asc
Description: Digital signature


Bug#694965: netcfg: Allow setup of pointopoint routes to reach gateway

2012-12-03 Thread Philipp Kern
On Mon, Dec 03, 2012 at 11:57:43PM +0100, Philipp Kern wrote:
> On Sun, Dec 02, 2012 at 08:54:01PM +0100, Michael Neuffer wrote:
> > There already seems to be some code in static.c like the code below,
> > but it doesn't seem to be working
> 
> Well, it's only triggered for known point-to-point devices:
> 
> if (strncmp(iface->name, "plip", 4) == 0
> || strncmp(iface->name, "slip", 4) == 0
> || strncmp(iface->name, "ctc", 3) == 0
> || strncmp(iface->name, "escon", 5) == 0
> || strncmp(iface->name, "iucv", 4) == 0)
> state = GET_POINTOPOINT;
> 
> I don't think it makes sense to ask it at any default priority value.
> We might ask it at "low" but in any case the real use of that option
> should be through preseeding for devices other than the ones listed
> above.

Furthermore netcfg_gateway_reachable would need to be extended to
check for the pointopoint route.

Kind regards
Philipp Kern


signature.asc
Description: Digital signature


Bug#694965: netcfg: Allow setup of pointopoint routes to reach gateway

2012-12-03 Thread Philipp Kern
On Sun, Dec 02, 2012 at 08:54:01PM +0100, Michael Neuffer wrote:
> There already seems to be some code in static.c like the code below,
> but it doesn't seem to be working

Well, it's only triggered for known point-to-point devices:

if (strncmp(iface->name, "plip", 4) == 0
|| strncmp(iface->name, "slip", 4) == 0
|| strncmp(iface->name, "ctc", 3) == 0
|| strncmp(iface->name, "escon", 5) == 0
|| strncmp(iface->name, "iucv", 4) == 0)
state = GET_POINTOPOINT;

I don't think it makes sense to ask it at any default priority value.
We might ask it at "low" but in any case the real use of that option
should be through preseeding for devices other than the ones listed
above.

Kind regards
Philipp Kern


signature.asc
Description: Digital signature


Bug#694965: netcfg: Allow setup of pointopoint routes to reach gateway

2012-12-02 Thread Michael Neuffer
There already seems to be some code in static.c like the code below, but 
it doesn't seem to be working


Manual configuration always only cycles through the following requests:
IP Address
Mask
Gateway

then it seems to try to configure the network and complains about an 
unreachable gateway.


Instead I'd expect it to pop up the query for the pointopoint link.

Sometimes you can even trigger netcfg tp pop up a dialog box which shows 
the network config overview and there it is obvious that there is a 
unfilled pointopoint variable.


So this is rather a bug to be fixed then a wishlist item.

Please fix.

Thank you.

Cheers
  Mike

static int netcfg_get_pointopoint(struct debconfclient *client, struct 
netcfg_interface *interface)

{
int ret, ok = 0;
union inX_addr addr;

while (!ok) {
debconf_input(client, "critical", "netcfg/get_pointopoint");
ret = debconf_go(client);

if (ret)
return ret;

debconf_get(client, "netcfg/get_pointopoint");

if (empty_str(client->value)) {   /* No P-P is ok */
interface->pointopoint[0] = '\0';
return 0;
}

ok = inet_pton (interface->address_family, client->value, &addr);

if (!ok) {
debconf_capb(client);
debconf_input (client, "critical", "netcfg/bad_ipaddress");
debconf_go (client);
debconf_capb(client, "backup");
}
}

inet_ntop(interface->address_family, &addr, interface->pointopoint, 
NETCFG_ADDRSTRLEN);

return 0;
}


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#694965: netcfg: Allow setup of pointopoint routes to reach gateway

2012-12-02 Thread Michael Neuffer

Package: netcfg
Severity: wishlist

Please add the possibility to specify pointopoint
routes when setting up the networking in the Debian Installer.

The result would look like something like this:

iface eth0 inet static
address a.b.c.d
netmask 255.255.255.255
gateway e.f.g.h
pointopoint e.f.g.h


Afterwards this routing would look like:

root@alpha:~# ip route
default via e.f.g.h dev eth0
e.f.g.h dev eth0  proto kernel  scope link  src a.b.c.d
root@alpha:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric RefUse Iface
0.0.0.0 e.f.g.h 0.0.0.0 UG0  00 eth0
e.f.g.h 0.0.0.0 255.255.255.255 UH0  00 eth0



At the moment I don't know of any other way to configure this besides
skipping the network confguration at installation time and then doing a
manual network configuration afterwards.

Or is there some other option that I'm just not aware of?

With the growing shortage of IPv4 adress space this will probably become 
more and more common.


At least for one large hoster in Germany this is already the standard
mode of operation if you want to have more then one IP address (for
virtual machines for example).

Cheers
  Mike


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org