svn commit: r217013 - in head: sbin/ifconfig sys/net

Marius Strobl marius at alchemy.franken.de
Wed Jan 5 15:55:15 UTC 2011


On Wed, Jan 05, 2011 at 03:34:30PM +0000, Bjoern A. Zeeb wrote:
> On Wed, 5 Jan 2011, Marius Strobl wrote:
> 
> >Author: marius
> >Date: Wed Jan  5 15:28:30 2011
> >New Revision: 217013
> >URL: http://svn.freebsd.org/changeset/base/217013
> >
> >Log:
> > Teach ifconfig(8) the handy shared option shortcut aliases the NetBSD
> > counterpart also takes, i.e. "fdx" for "full-duplex", "flow" for
> > "flowcontrol", "hdx" for "half-duplex" as well as "loop" and "loopback"
> > for "hw-loopback".
> 
> I am not sure this is a good idea.  Unless this is really really
> useful for compatibility with scripts (which I doubt) it'll sooner or
> later cause headaches, especially given some of the (new) names could
> be very well used for different things as well.

Could you please elaborate on what different use you have in mind?
Generally it seems a bad idea to me if the existing options and the
new names as implemented would trigger different things as you suggest
given the latter are rather common abbreviations as well as diverging
from the user interface of the other BSDs seems like a bad idea (i.e.
not only not supporting the same names they do but also controlling
different things with a given one). Also the concept of aliases taken
by ifconfig(8) isn't new, we support several including f.e. "auto" for
"autoselect" for quite some time.

Marius

> 
> 
> > MFC after:	1 week
> >
> >Modified:
> > head/sbin/ifconfig/ifmedia.c
> > head/sys/net/if_media.h
> >
> >Modified: head/sbin/ifconfig/ifmedia.c
> >==============================================================================
> >--- head/sbin/ifconfig/ifmedia.c	Wed Jan  5 15:10:58 2011 (r217012)
> >+++ head/sbin/ifconfig/ifmedia.c	Wed Jan  5 15:28:30 2011 (r217013)
> >@@ -421,6 +421,9 @@ static struct ifmedia_description ifm_su
> >static struct ifmedia_description ifm_shared_option_descriptions[] =
> >    IFM_SHARED_OPTION_DESCRIPTIONS;
> >
> >+static struct ifmedia_description ifm_shared_option_aliases[] =
> >+    IFM_SHARED_OPTION_ALIASES;
> >+
> >struct ifmedia_type_to_subtype {
> >	struct {
> >		struct ifmedia_description *desc;
> >@@ -429,7 +432,7 @@ struct ifmedia_type_to_subtype {
> >	struct {
> >		struct ifmedia_description *desc;
> >		int alias;
> >-	} options[3];
> >+	} options[4];
> >	struct {
> >		struct ifmedia_description *desc;
> >		int alias;
> >@@ -448,6 +451,7 @@ static struct ifmedia_type_to_subtype if
> >		},
> >		{
> >			{ &ifm_shared_option_descriptions[0], 0 },
> >+			{ &ifm_shared_option_aliases[0], 1 },
> >			{ &ifm_subtype_ethernet_option_descriptions[0], 0 },
> >			{ NULL, 0 },
> >		},
> >@@ -465,6 +469,7 @@ static struct ifmedia_type_to_subtype if
> >		},
> >		{
> >			{ &ifm_shared_option_descriptions[0], 0 },
> >+			{ &ifm_shared_option_aliases[0], 1 },
> >			{ &ifm_subtype_tokenring_option_descriptions[0], 0 },
> >			{ NULL, 0 },
> >		},
> >@@ -482,6 +487,7 @@ static struct ifmedia_type_to_subtype if
> >		},
> >		{
> >			{ &ifm_shared_option_descriptions[0], 0 },
> >+			{ &ifm_shared_option_aliases[0], 1 },
> >			{ &ifm_subtype_fddi_option_descriptions[0], 0 },
> >			{ NULL, 0 },
> >		},
> >@@ -499,6 +505,7 @@ static struct ifmedia_type_to_subtype if
> >		},
> >		{
> >			{ &ifm_shared_option_descriptions[0], 0 },
> >+			{ &ifm_shared_option_aliases[0], 1 },
> >			{ &ifm_subtype_ieee80211_option_descriptions[0], 0 },
> >			{ NULL, 0 },
> >		},
> >@@ -518,6 +525,7 @@ static struct ifmedia_type_to_subtype if
> >		},
> >		{
> >			{ &ifm_shared_option_descriptions[0], 0 },
> >+			{ &ifm_shared_option_aliases[0], 1 },
> >			{ &ifm_subtype_atm_option_descriptions[0], 0 },
> >			{ NULL, 0 },
> >		},
> >
> >Modified: head/sys/net/if_media.h
> >==============================================================================
> >--- head/sys/net/if_media.h	Wed Jan  5 15:10:58 2011	(r217012)
> >+++ head/sys/net/if_media.h	Wed Jan  5 15:28:30 2011	(r217013)
> >@@ -598,6 +598,15 @@ struct ifmedia_description {
> >	{ 0, NULL },							\
> >}
> >
> >+#define	IFM_SHARED_OPTION_ALIASES {				 \
> >+	{ IFM_FDX,	"fdx" },					\
> >+	{ IFM_HDX,	"hdx" },					\
> >+	{ IFM_FLOW,	"flow" },					\
> >+	{ IFM_LOOP,	"loop" },					\
> >+	{ IFM_LOOP,	"loopback" },					\
> >+	{ 0, NULL },							\
> >+}
> >+
> >/*
> > * Baudrate descriptions for the various media types.
> > */
> >
> 
> -- 
> Bjoern A. Zeeb                                 You have to have visions!
>         <ks> Going to jail sucks -- <bz> All my daemons like it!
>   http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/jails.html


More information about the svn-src-head mailing list