bug-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ifconfig and some minor fixes.


From: Marcus Brinkmann
Subject: Re: ifconfig and some minor fixes.
Date: Mon, 4 Jun 2001 23:42:08 +0200
User-agent: Mutt/1.3.18i

On Mon, Jun 04, 2001 at 02:47:35PM +0300, Sergey Poznyakoff wrote:
> Here are some minor fixes for the package. I have finally made
> ifconfig work on Solaris.

Thanks a lot, Sergey!  I apology for the obvious buglets in the code, I left
it in a worse state I remembered ;)

I have incorporated all the smaller changes, and leave the if_nameindex
stuff for tomorrow or so.  Here are a few answers and questions.

> Some notes: I had to unconditionally add if_index.c to the build
> since the generic if_nameindex function does not return any
> information about interface aliases, e.g. elxl2:0. I can't propose
> any reliable way to check for this in configure.in, so maybe we'd
> be better off providing the replacement unconditionally...

I think Solaris' implementation of if_nameindex might need to be fixed ;)
I prefer the more standardized interface, but I understand the problem.
I don't want to use if_index.c on the Hurd though, so we will have to add
some configure check for this.  For example, use if_nameindex if available,
otherwise fall back to if_index.c, but leave the possibility for platform
specific overrides in configure.c.  Sun would get one because of the
aliases.

> By the way, what's <stdint.h>? It wasn't found on any system I have
> access to (Solaris, SunOS, GNU/Linux, FreeBSD). Was it a typo?

We don't need that anyway.  I was not very careful about the headers, so it
slipped in from some c&p action.
 
> Another question regarding ifconfig: is it planned to add the up/down
> functionality? For example, the standard way to put an interface down
> was:
> 
>       ifconfig en0 down
> 
> In case of GNU ifconfig it would be something like
> 
>       ifconfig --interface en0 --flags down
> 
> I suppose it would be very useful.

Yes, flag handling is entirely lacking on the command line.  I want to make
it possible to set/clear arbitraty flags.  So, it would be more like

--clear-flag UP

or so.  (The systems syntax of "en0 down" would be left intact, of course).
(Maybe the GNU interface will get a more fancy extension later, but clearing
UP is what matches most closely the actual implementation, and this will be
the first incarnation of that feature).

> OK, so here goes the patch:

Done:
  * ifconfig/ifconfig.c: include <sys/socket.h>
  * ifconfig/changeif.c: #include <sys/socket.h>
  * ifconfig/ifconfig.h, ifconfig/printif.h: removed #include <config.h>,
    it caused multiple inclusions. Moved #include to *.c files.
  * ifconfig/printif.c: removed include <stdint.h>,
  * ifconfig/printif.c: added include <sys/socket.h>.
  * ifconfig/system/linux.c: removed include <stdint.h>
  * ifconfig/system/generic.c: placeholder for system_configure()
  * ifconfig/system/solaris.c: fixed includes, and some minor errors.
  * ifconfig/system/solaris.h: fixed includes.

Very slightly different:
  * ifconfig/options.c: include <sys/socket.h>. Added defaults for
    SYSTEM_SHORT_OPTIONS, SYSTEM_LONG_OPTIONS.

Postponed:
  * configure.in, headers/acconfig.h: check for declarations of
    sa_family_t and struct if_nameindex.
  * ifconfig/Makefile.am: Added if_index.c to build. It seems better
    to use it instead of system if_nameindex (even if available).
    Solaris if_nameindex does not return interface aliases, e.g
    elxl2:0, whereas the version in if_index.c always returns all
    interfaces. 
  * ifconfig/if_index.c: fixed map_interfaces(), implemented
    if_nametoindex.
  * ifconfig/options.h: Definition of struct if_nameindex for systems
    lacking it.

(Not on the Hurd, alas!)

Not my business: ;)
  * ftpd/ftpd.c: MAP_FAILED is not defined on some systems
    (e.g. Solaris, SunOS)
  * headers/paths.h: Added missing _PATH_LOGCONF, _PATH_LOGPID,
    _PATH_LOG
  * libls/print.c: Provided defaults for major() and minor() macros
    for systems lacking them.

My questions:

  * ifconfig/flags.c: #include <sys/socket.h>
  * ifconfig/options.c: include <sys/socket.h>.
MB: Why are they needed in flags.c, options.c? <net/if.h> should suffice.

  * ifconfig/printif.c: Use ifr->ifr_addr instead of
    ifr->ifr_netmask in fh_netmask(). The netmask gets returned in
    both fields, but ifr_netmask is absent on some systems.
MB: I'd prefer to do
#define ifr_netmask ifr_addr
on such systems.  Is Solaris such a system?

  * ifconfig/system.c, ifconfig/system.h: added ifdef __sun__ clause
MB: What's the story between __sun__ and __solaris__?  I changed __solaris__
to __sun__ now, as I don't remember why I put __solaris__ there.  Do older
systems define __sun__, too?

  * ifconfig/system/solaris.c: Added system_configure().
MB: Has Solaris IFTXQLEN? What is the FIXME supposed to mean?

Thanks,
Marcus

-- 
`Rhubarb is no Egyptian god.' Debian http://www.debian.org address@hidden
Marcus Brinkmann              GNU    http://www.gnu.org    address@hidden
address@hidden
http://www.marcus-brinkmann.de



reply via email to

[Prev in Thread] Current Thread [Next in Thread]