Browse Source

Stop writing netmask/network/broadcast lines in /etc/network/interfaces

Just set the prefix length as part of the address.

Signed-off-by: Julien Cristau <jcristau@debian.org>
tags/1.140
Julien Cristau 4 years ago
parent
commit
8974e30675
2 changed files with 10 additions and 14 deletions
  1. +7
    -0
      debian/changelog
  2. +3
    -14
      write_interface.c

+ 7
- 0
debian/changelog View File

@@ -1,3 +1,10 @@
netcfg (1.140) UNRELEASED; urgency=medium

* Stop writing netmask/network/broadcast lines in /etc/network/interfaces,
just set the prefix length as part of the address.

-- Julien Cristau <jcristau@debian.org> Mon, 17 Oct 2016 23:27:27 +0200

netcfg (1.139) unstable; urgency=medium

[ Updated translations ]


+ 3
- 14
write_interface.c View File

@@ -112,24 +112,14 @@ static int nc_wi_slaac(const struct netcfg_interface *interface, FILE *fd)
*/
static int nc_wi_static_ipv4(const struct netcfg_interface *interface, FILE *fd)
{
char network[INET_ADDRSTRLEN];
char broadcast[INET_ADDRSTRLEN];
char netmask[INET_ADDRSTRLEN];

netcfg_network_address(interface, network);
netcfg_broadcast_address(interface, broadcast);
inet_mtop(AF_INET, interface->masklen, netmask, INET_ADDRSTRLEN);

fprintf(fd, "\n# The primary network interface\n");
if (!iface_is_hotpluggable(interface->name) && !find_in_stab(interface->name))
fprintf(fd, "auto %s\n", interface->name);
else
fprintf(fd, "allow-hotplug %s\n", interface->name);
fprintf(fd, "iface %s inet static\n", interface->name);
fprintf(fd, "\taddress %s\n", interface->ipaddress);
fprintf(fd, "\tnetmask %s\n", empty_str(interface->pointopoint) ? netmask : "255.255.255.255");
fprintf(fd, "\tnetwork %s\n", network);
fprintf(fd, "\tbroadcast %s\n", broadcast);
fprintf(fd, "\taddress %s/%i\n", interface->ipaddress,
empty_str(interface->pointopoint) ? interface->masklen : 32);
if (!empty_str(interface->gateway))
fprintf(fd, "\tgateway %s\n",
empty_str(interface->pointopoint) ? interface->gateway : interface->pointopoint);
@@ -149,8 +139,7 @@ static int nc_wi_static_ipv6(const struct netcfg_interface *interface, FILE *fd)
else
fprintf(fd, "allow-hotplug %s\n", interface->name);
fprintf(fd, "iface %s inet6 static\n", interface->name);
fprintf(fd, "\taddress %s\n", interface->ipaddress);
fprintf(fd, "\tnetmask %i\n", interface->masklen);
fprintf(fd, "\taddress %s/%i\n", interface->ipaddress, interface->masklen);
if (!empty_str(interface->gateway))
fprintf(fd, "\tgateway %s\n", interface->gateway);



Loading…
Cancel
Save