Discussion:
extensible ifconfig
(too old to reply)
David Young
2008-04-29 05:38:36 UTC
Permalink
I have refactored ifconfig to get rid of many global variables
and to improve extensibility. Please apply the patch,
ftp://cuw.ojctech.com/users/netbsd-81aa8ffc/ifconfig.patch, and test!

I have lightly tested IPv4, IPv6, 802.11, tunnel, and media configuration.
I especially need your help to test AppleTalk, ISO, carp(4), agr(4),
and vlan(4) configuration.

*** Details ***

In the extensible ifconfig, a directed graph of argument-matching objects
(match objects) expresses the set of feasible ifconfig statements[1].
Each match object matches a command-line argument; each path through the
match-object graph from an initial match object (selected by the flags)
to a terminal object is a sentence in ifconfig's language.

In principle, the match-object graph can be modified at run-time by, for
example, loading a dynamic library. In this way, ifconfig can be extended
to handle new configuration statements. Hence "extensible ifconfig".
In current practice, the graph is statically initialized.

Today, there are five classes of match object, each class recognizing
a different lexical category:

piface: match an interface name, xxxNN

paddr: match an IPv4, IPv6, ISO, AppleTalk, or link-layer address

pkw: match a keyword and use it to select the next match object

pinteger: match an integer

pstr: match a string

There are two special match objects that match no tokens:

pbranch: try each of zero or more match objects in turn; backtrack
on failure, quit on success

pterm: matches the end of the command line

A match object may be labelled with "exec" routines. Exec routines
provide the ifconfig argument's semantics.

ifconfig operates in two phases, parse and execute. In the parse phase,
match objects match command-line arguments, extracting information from
each argument, such as an IP addresses and prefix length, and storing it
in property dictionaries. The property dictionaries provide environment
variables for the execute phase, when ifconfig runs matching object's
exec routines.

Dave

[1] The idea to use a graph of argument-matching objects to make an
extensible parser comes from Chris Hopps.
--
David Young OJC Technologies
***@ojctech.com Urbana, IL * (217) 278-3933 ext 24

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
David Young
2008-04-30 00:19:17 UTC
Permalink
Post by David Young
I have refactored ifconfig to get rid of many global variables
and to improve extensibility. Please apply the patch,
ftp://cuw.ojctech.com/users/netbsd-81aa8ffc/ifconfig.patch, and test!
Here is the latest,

ftp://cuw.ojctech.com/users/netbsd-f8eb2c9d/ifconfig.patch

Dave
--
David Young OJC Technologies
***@ojctech.com Urbana, IL * (217) 278-3933 ext 24

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Jukka Ruohonen
2008-05-15 20:30:03 UTC
Permalink
Post by David Young
I have refactored ifconfig to get rid of many global variables
and to improve extensibility. Please apply the patch,
ftp://cuw.ojctech.com/users/netbsd-81aa8ffc/ifconfig.patch, and test!
Hi,

I gather this is related (4.99.62 sources from yesterday):

# ifconfig wpi0 ssid ""
assertion "(pd->pd_size == 0 && pd->pd_un.pdu_immutable == (void *)0) ||
# (pd->pd_size != 0 && pd->pd_un.pdu_immutable != (void *)0)" failed: file
"/usr/src/common/lib/libprop/prop_data.c", line 346, function
# "prop_data_data_nocopy"
[1] Abort trap (core dumped) ifconfig wpi0 ssid ""


- Jukka R.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
David Young
2008-05-15 21:10:10 UTC
Permalink
Post by Jukka Ruohonen
Post by David Young
I have refactored ifconfig to get rid of many global variables
and to improve extensibility. Please apply the patch,
ftp://cuw.ojctech.com/users/netbsd-81aa8ffc/ifconfig.patch, and test!
Hi,
# ifconfig wpi0 ssid ""
assertion "(pd->pd_size == 0 && pd->pd_un.pdu_immutable == (void *)0) ||
# (pd->pd_size != 0 && pd->pd_un.pdu_immutable != (void *)0)" failed: file
"/usr/src/common/lib/libprop/prop_data.c", line 346, function
# "prop_data_data_nocopy"
[1] Abort trap (core dumped) ifconfig wpi0 ssid ""
Apparently, prop_data_create_data(blob, len) doesn't like to be called
with blob != NULL and len == 0. I'm testing a fix.

Dave
--
David Young OJC Technologies
***@ojctech.com Urbana, IL * (217) 278-3933 ext 24

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
David Young
2008-05-15 21:24:05 UTC
Permalink
Post by David Young
Post by Jukka Ruohonen
Post by David Young
I have refactored ifconfig to get rid of many global variables
and to improve extensibility. Please apply the patch,
ftp://cuw.ojctech.com/users/netbsd-81aa8ffc/ifconfig.patch, and test!
Hi,
# ifconfig wpi0 ssid ""
assertion "(pd->pd_size == 0 && pd->pd_un.pdu_immutable == (void *)0) ||
# (pd->pd_size != 0 && pd->pd_un.pdu_immutable != (void *)0)" failed: file
"/usr/src/common/lib/libprop/prop_data.c", line 346, function
# "prop_data_data_nocopy"
[1] Abort trap (core dumped) ifconfig wpi0 ssid ""
Apparently, prop_data_create_data(blob, len) doesn't like to be called
with blob != NULL and len == 0. I'm testing a fix.
Update to src/common/lib/libprop/prop_data.c revision 1.12.

Dave
--
David Young OJC Technologies
***@ojctech.com Urbana, IL * (217) 278-3933 ext 24

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Pierre Pronchery
2008-05-16 16:26:18 UTC
Permalink
Post by David Young
I have refactored ifconfig to get rid of many global variables
and to improve extensibility. Please apply the patch,
ftp://cuw.ojctech.com/users/netbsd-81aa8ffc/ifconfig.patch, and test!
I have lightly tested IPv4, IPv6, 802.11, tunnel, and media configuration.
I especially need your help to test AppleTalk, ISO, carp(4), agr(4),
and vlan(4) configuration.
With -current as of May 9th, I get this on my sparc64 machine:
# ifconfig vlan0 vlan 1 vlanif hme0
ifconfig: SIOCAIFADDR: Address family not supported by protocol family

This worked with the same kernel, before updating the userland (which
was months old).

Can this be related to your latest changes?

HTH,
--
khorben


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
David Young
2008-05-16 20:54:16 UTC
Permalink
Post by Pierre Pronchery
Post by David Young
I have refactored ifconfig to get rid of many global variables
and to improve extensibility. Please apply the patch,
ftp://cuw.ojctech.com/users/netbsd-81aa8ffc/ifconfig.patch, and test!
I have lightly tested IPv4, IPv6, 802.11, tunnel, and media configuration.
I especially need your help to test AppleTalk, ISO, carp(4), agr(4),
and vlan(4) configuration.
# ifconfig vlan0 vlan 1 vlanif hme0
ifconfig: SIOCAIFADDR: Address family not supported by protocol family
This worked with the same kernel, before updating the userland (which
was months old).
Can this be related to your latest changes?
Thanks for the report. Update to src/sbin/ifconfig/vlan.c revision 1.9.
I believe that will fix it.

Dave
--
David Young OJC Technologies
***@ojctech.com Urbana, IL * (217) 278-3933 ext 24

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Pierre Pronchery
2008-05-17 10:00:35 UTC
Permalink
Post by David Young
Post by Pierre Pronchery
Post by David Young
I have refactored ifconfig to get rid of many global variables
and to improve extensibility. Please apply the patch,
ftp://cuw.ojctech.com/users/netbsd-81aa8ffc/ifconfig.patch, and test!
I have lightly tested IPv4, IPv6, 802.11, tunnel, and media configuration.
I especially need your help to test AppleTalk, ISO, carp(4), agr(4),
and vlan(4) configuration.
# ifconfig vlan0 vlan 1 vlanif hme0
ifconfig: SIOCAIFADDR: Address family not supported by protocol family
This worked with the same kernel, before updating the userland (which
was months old).
Can this be related to your latest changes?
Thanks for the report. Update to src/sbin/ifconfig/vlan.c revision 1.9.
I believe that will fix it.
It does, thanks!
--
khorben


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Jukka Ruohonen
2008-05-18 18:02:14 UTC
Permalink
Post by David Young
Post by David Young
Apparently, prop_data_create_data(blob, len) doesn't like to be called
with blob != NULL and len == 0. I'm testing a fix.
Update to src/common/lib/libprop/prop_data.c revision 1.12.
Revision 1.12 works fine, thanks.

- Jukka R.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Loading...