Mercurial > illumos > illumos-gate
changeset 13769:2317a7492de4
3013 ifconfig with no args should list all interfaces
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Gary Mills <gary_mills@fastmail.fm>
Approved by: Albert Lee <trisk@nexenta.com>
author | Daniil Lunev <d.lunev.mail@gmail.com> |
---|---|
date | Tue, 31 Jul 2012 21:33:14 +0000 |
parents | ed21ea5d20cf |
children | f6f7025c7a4d |
files | usr/src/cmd/cmd-inet/usr.sbin/ifconfig/ifconfig.c usr/src/man/man1m/ifconfig.1m |
diffstat | 2 files changed, 31 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/cmd-inet/usr.sbin/ifconfig/ifconfig.c Fri Aug 10 10:52:49 2012 -0400 +++ b/usr/src/cmd/cmd-inet/usr.sbin/ifconfig/ifconfig.c Tue Jul 31 21:33:14 2012 +0000 @@ -1,3 +1,6 @@ +/* + * Copyright 2012, Daniil Lunev. All rights reserved. + */ /* * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved. */ @@ -380,15 +383,16 @@ lifc_flags = LIFC_DEFAULT; if (argc < 2) { - usage(); - exit(1); + (void) strncpy(name, "-a", sizeof (name)); + } else { + argc--, argv++; + if (strlen(*argv) > sizeof (name) - 1) { + (void) fprintf(stderr, "%s: interface name too long\n", + *argv); + exit(1); + } + (void) strncpy(name, *argv, sizeof (name)); } - argc--, argv++; - if (strlen(*argv) > sizeof (name) - 1) { - (void) fprintf(stderr, "%s: interface name too long\n", *argv); - exit(1); - } - (void) strncpy(name, *argv, sizeof (name)); name[sizeof (name) - 1] = '\0'; (void) strncpy(origname, name, sizeof (origname)); /* For addif */ default_ip_str = NULL; @@ -452,7 +456,7 @@ int c; char *av[2] = { "ifconfig", name }; - while ((c = getopt(2, av, "audDXZ46v")) != -1) { + while ((c = getopt(2, av, "audhDXZ46v")) != -1) { switch ((char)c) { case 'a': all = 1; @@ -491,6 +495,7 @@ case 'v': verbose = 1; break; + case 'h': case '?': usage(); exit(1);
--- a/usr/src/man/man1m/ifconfig.1m Fri Aug 10 10:52:49 2012 -0400 +++ b/usr/src/man/man1m/ifconfig.1m Tue Jul 31 21:33:14 2012 +0000 @@ -1,8 +1,9 @@ '\" te +.\" Copyright (C) 2012, Darren Reed. All rights reserved .\" Copyright (C) 2009, Sun Microsystems, Inc. All Rights Reserved .\" Copyright 1989 AT&T .\" Copyright (c) 1983 Regents of the University of California. All rights reserved. The Berkeley software License Agreement specifies the terms and conditions for redistribution. -.TH IFCONFIG 1M "Aug 13, 2009" +.TH IFCONFIG 1M "July 23, 2012" .SH NAME ifconfig \- configure network interface parameters .SH SYNOPSIS @@ -48,7 +49,17 @@ specific to that address family. Only privileged users may modify the configuration of a network interface. Options appearing within braces (\fB{\|}\fR) indicate that one of the options must be specified. -.SS "DHCP Configuration" +.SS Network Interface Observability +.sp +.LP +Network interface observability with \fBifconfig\fR is limited to those +network interfaces that have been prepared for use with the IP +protocol suite. The preferred method for configuring a network +interface for use with TCP/IP is with \fBipadm\fR and alternatively +with the use of the \fBplumb\fR option as documented below. Network +interfaces that have not been configured for use with the IP +protocol suite can only be observed by using the \fBdladm\fR command. +.SS DHCP Configuration .sp .LP The forms of \fBifconfig\fR that use the \fBauto-dhcp\fR or \fBdhcp\fR @@ -63,6 +74,10 @@ .SH OPTIONS .sp .LP +When the \fBifconfig\fR command is executed without any options +its behavior is the same as when the \fB\-a\fR option is supplied +with no other options or arguments. +.LP The following options are supported: .sp .ne 2