Bug#327031: ifdown routine only works on Linux

2005-09-12 Thread Petter Reinholdtsen

 The ifdown() routine in src/ifdown.c (called by halt or reboot when
 passed -i flag) produces weird output on GNU/kFreeBSD (prints
 uninitialised strings).

Looking at the code, I fail to understand why this give such result.
Can you explain more?

I'm not to happy about just commenting out the code, as it would make
init behanve differently (and not according to the documentation) on
non-linux platforms.

Is the ioctl-call broken on freebsd?  Is it the wrong one?  What
exactly is the problem?


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#327031: ifdown routine only works on Linux

2005-09-12 Thread Robert Millan
On Mon, Sep 12, 2005 at 04:08:19PM +0200, Petter Reinholdtsen wrote:
 
  The ifdown() routine in src/ifdown.c (called by halt or reboot when
  passed -i flag) produces weird output on GNU/kFreeBSD (prints
  uninitialised strings).
 
 Looking at the code, I fail to understand why this give such result.
 Can you explain more?
 
 I'm not to happy about just commenting out the code, as it would make
 init behanve differently (and not according to the documentation) on
 non-linux platforms.
 
 Is the ioctl-call broken on freebsd?  Is it the wrong one?  What
 exactly is the problem?

Ok, you win :).

It seems on kFreeBSD, some interfaces are phantom ones.  They exist, and are
detected by the numif assignment in ifdown.c, but their ifr_name component only
contains trash  (on my system, there are 2 normal interfaces, and 8 phantom
ones).

Attempting to shut them down will fail with ENXIO (interpreted in this context
as no such device).

I'm not sure how to distinguish them (I've put the kfreebsd-gnu list on CC).

-- 
Robert Millan


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#327031: ifdown routine only works on Linux

2005-09-07 Thread Robert Millan
Package: sysvinit
Version: 2.86.ds1-1.1
Severity: normal
Tags: patch

The ifdown() routine in src/ifdown.c (called by halt or reboot when passed -i
flag) produces weird output on GNU/kFreeBSD (prints uninitialised strings).
 
Since this feature is not very useful, because netbase already shuts down
interfaces, I haven't bothered to port it.  Here's a patch that turns ifdown()
into a dummy stub for non-Linux systems.
 
Please note that we still need the -i command-line flags since other scritps
seem to rely on them, though.

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.11-1-k7
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ANSI_X3.4-1968) (ignored: LC_ALL 
set to C)

Versions of packages sysvinit depends on:
ii  coreutils   5.2.1-2  The GNU core utilities
ii  initscripts 2.86.ds1-1.1 Standard scripts needed for bootin
ii  libc6   2.3.5-4  GNU C Library: Shared libraries an
ii  sysv-rc 2.86.ds1-1.1 Standard boot mechanism using syml

sysvinit recommends no packages.

-- no debconf information
diff -ur sysvinit-2.86.ds1/src/ifdown.c sysvinit-2.86.ds1.new/src/ifdown.c
--- sysvinit-2.86.ds1/src/ifdown.c	1998-06-02 22:41:47.0 +0200
+++ sysvinit-2.86.ds1.new/src/ifdown.c	2005-09-06 14:50:21.0 +0200
@@ -29,6 +29,7 @@
  */
 int ifdown(void)
 {
+#ifdef __linux__
 	struct ifreq ifr[MAX_IFS];
 	struct ifconf ifc;
 	int i, fd;
@@ -69,6 +70,7 @@
 		}
 	}
 	close(fd);
+#endif  /* __linux__ */
 
 	return 0;
 }