- assigning netmask after the adress

This commit is contained in:
Radek Vokál 2004-11-02 13:46:01 +00:00
parent 7151ccf465
commit 2c13669c85
2 changed files with 68 additions and 1 deletions

View File

@ -0,0 +1,61 @@
--- net-tools-1.60/ifconfig.c.netmask 2001-04-13 20:25:18.000000000 +0200
+++ net-tools-1.60/ifconfig.c 2004-11-02 15:31:56.454594456 +0100
@@ -23,6 +23,7 @@
* 20001008 - Bernd Eckenfels, Patch from RH for setting mtu
* (default AF was wrong)
* 20010404 - Arnaldo Carvalho de Melo, use setlocale
+ * 20040831 - Florin Malita <fmalita@glenayre.com> delayed CIDR netmask
*/
#define DFLT_AF "inet"
@@ -227,13 +228,13 @@
int main(int argc, char **argv)
{
- struct sockaddr sa;
+ struct sockaddr sa, sa_netmask;
struct sockaddr_in sin;
char host[128];
struct aftype *ap;
struct hwtype *hw;
struct ifreq ifr;
- int goterr = 0, didnetmask = 0;
+ int goterr = 0, didnetmask = 0, donetmask = 0;
char **spp;
int fd;
#if HAVE_AFINET6
@@ -903,16 +904,16 @@
/* FIXME: sa is too small for INET6 addresses, inet6 should use that too,
broadcast is unexpected */
if (ap->getmask) {
- switch (ap->getmask(host, &sa, NULL)) {
+ switch (ap->getmask(host, &sa_netmask, NULL)) {
case -1:
usage();
break;
case 1:
if (didnetmask)
usage();
-
- goterr = set_netmask(skfd, &ifr, &sa);
- didnetmask++;
+
+ /* delay setting the CIDR netmask till after setting the addr */
+ donetmask = 1;
break;
}
}
@@ -960,6 +961,13 @@
}
}
+ /* set CIDR netmask */
+ if (donetmask) {
+ donetmask = 0;
+ goterr = set_netmask(skfd, &ifr, &sa_netmask);
+ didnetmask++;
+ }
+
/*
* Don't do the set_flag() if the address is an alias with a - at the
* end, since it's deleted already! - Roman

View File

@ -3,7 +3,7 @@
Summary: Basic networking tools.
Name: net-tools
Version: 1.60
Release: 37
Release: 38
License: GPL
Group: System Environment/Base
Source0: http://www.tazenda.demon.co.uk/phil/net-tools/net-tools-%{version}.tar.bz2
@ -33,6 +33,7 @@ Patch19: net-tools-1.60-siunits.patch
Patch20: net-tools-1.60-trunc.patch
Patch21: net-tools-1.60-return.patch
Patch22: net-tools-1.60-parse.patch
Patch23: net-tools-1.60-netmask.patch
BuildRoot: %{_tmppath}/%{name}-root
Requires(post,preun): chkconfig
BuildRequires: gettext
@ -65,6 +66,7 @@ ifconfig, netstat, route, and others.
%patch20 -p1 -b .trunc
%patch21 -p1 -b .return
%patch22 -p1 -b .parse
%patch23 -p1 -b .netmask
cp %SOURCE2 ./config.h
cp %SOURCE3 ./config.make
@ -156,6 +158,10 @@ exit 0
%{_sysconfdir}/rc.d/init.d/netplugd
%changelog
* Tue Nov 02 2004 Radek Vokal <rvokal@redhat.com> 1.60-38
- fixed fail to assign the specified netmask before adress is assigned
- patch by Malita, Florin <florin.malita@glenayre.com>
* Wed Sep 29 2004 Radek Vokal <rvokal@redhat.com> 1.60-37
- spec file updated, added conversion for french and portugal man pages to UTF-8