doc: Add net.connman.iwd.NetworkConfiguration API doc
PATCH 1/3 doc: Add net.connman.iwd.NetworkConfiguration API doc
--- doc/network-configuration-api.txt | 52 +++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 doc/network-configuration-api.txt
doc/network-configuration-api.txt new file +52 -0
@@ -0,0 +1,52 @@ +Network Configuration hierarchy +=============================== + +Service net.connman.iwd +Interface net.connman.iwd.NetworkConfiguration [Experimental] +Object path /net/connman/iwd/{phy0,phy1,...}/{1,2,...}/{ipv4,ipv6} +Object path /net/connman/iwd/{phy0,phy1,...}/p2p_peers/{aa_bb_cc_dd_ee_ff} + +Properties object Device [readonly] + + The object path of the station, access point or P2P + device that this network configuration is active on. + + In station mode, when network configuration is + enabled there may be one or two objects using this + interface and active on the same device: two if both + IPv4 and IPv6 addresses have been configured. + + In P2P mode, this interface always refers to IPv4 + network configuration. + + string Method [readonly] + + Indicates whether the local address was set + statically (value "static") or obtained automatically + such as through DHCP (value "auto"). Even when the + address was obtained from the remote end some + configuration bits, such as DNS addresses, may have + been overridden locally. + + string Address [readonly] + + Holds the local IP address. + + byte PrefixLength [readonly] + + Holds the prefix-length of the local subnet. For + IPv4 this maps to the netmask. + + string Gateway [readonly, optional] + + Holds the gateway address for the IPv4 subnet if one + exists. + + array(string) DomainNameServers [readonly, optional] + + Holds the list of domain name servers configured if + any. + + string DomainNames [readonly, optional] + + Holds the network's local domain names if any exist.
Signature · 1 line
2.30.2
PATCH 2/3 netconfig: Add network configuration properties on Station and P2P
Add NetworkConfiguration D-Bus interfaces under the station and P2P objects that expose current IP configurations. Access Point and P2P-GO are not handled yet, and some of the IP config properties may not automatically generate PropertiesChanged on DHCP lease renewals but their values are unlikely to change.
--- src/dbus.h | 1 + src/netconfig.c | 531 +++++++++++++++++++++++++++++++++++++++++++----- src/netconfig.h | 3 +- src/p2p.c | 5 +- src/station.c | 17 +- 5 files changed, 496 insertions(+), 61 deletions(-)
src/dbus.h +1 -0
@@ -42,6 +42,7 @@#define IWD_P2P_WFD_INTERFACE "net.connman.iwd.p2p.Display"#define IWD_STATION_DIAGNOSTIC_INTERFACE "net.connman.iwd.StationDiagnostic"#define IWD_AP_DIAGNOSTIC_INTERFACE "net.connman.iwd.AccessPointDiagnostic" +#define IWD_NETCONFIG_INTERFACE "net.connman.iwd.NetworkConfiguration"#define IWD_BASE_PATH "/net/connman/iwd"#define IWD_AGENT_MANAGER_PATH IWD_BASE_PATH
src/netconfig.c +476 -55
729 lines not on this page · raw message
src/netconfig.h +2 -1
@@ -38,5 +38,6 @@ bool netconfig_reconfigure(struct netconfig *netconfig);bool netconfig_reset (struct netconfig *netconfig);char *netconfig_get_dhcp_server_ipv4 (struct netconfig *netconfig); -struct netconfig *netconfig_new (uint32_t ifindex); +struct netconfig *netconfig_new (uint32_t ifindex,const char *device_path, +const char *ipv4_path,const char *ipv6_path);void netconfig_destroy (struct netconfig *netconfig);
src/p2p.c +4 -1
@@ -1319,7 +1319,10 @@ static void p2p_start_client_netconfig(struct p2p_device *dev)struct l_settings *settings;if (!dev->conn_netconfig) { - dev->conn_netconfig =netconfig_new (ifindex); +const char *peer_path =p2p_peer_get_path (dev->conn_peer); + + dev->conn_netconfig =netconfig_new (ifindex, peer_path, + peer_path,NULL );if (!dev->conn_netconfig) {p2p_connect_failed (dev);return ;
src/station.c +13 -4
@@ -3568,6 +3568,7 @@ static struct station *station_create(struct netdev *netdev) {struct station *station;struct l_dbus *dbus =dbus_get_bus (); +const char *path; station = l_new(struct station, 1);watchlist_init (&station->state_watches,NULL );
@@ -3587,11 +3588,19 @@ static struct station *station_create(struct netdev *netdev)station_set_autoconnect (station, true); -l_dbus_object_add_interface (dbus,netdev_get_path (netdev), -IWD_STATION_INTERFACE , station); + path =netdev_get_path (netdev); +l_dbus_object_add_interface (dbus, path,IWD_STATION_INTERFACE , station); + +if (netconfig_enabled) { + L_AUTO_FREE_VAR(char *, ipv4_path) = +l_strdup_printf ("%s/ipv4" , path); + L_AUTO_FREE_VAR(char *, ipv6_path) = +l_strdup_printf ("%s/ipv6" , path); -if (netconfig_enabled) - station->netconfig =netconfig_new (netdev_get_ifindex (netdev)); + station->netconfig =netconfig_new (netdev_get_ifindex (netdev), + path, ipv4_path, + ipv6_path); + } station->anqp_pending =l_queue_new ();
Signature · 1 line
2.30.2
PATCH 3/3 netconfig: Reserve INET_ADDRSTRLEN chars for an IPv4 string
In reply to Andrew ZaborowskiFor consistency replace an INET6_ADDRSTRLEN instance with INET_ADDRSTRLEN in a strictly IPv4 context in netconfig_ipv4_select_and_install.
--- src/netconfig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/netconfig.c +1 -1
@@ -1114,7 +1114,7 @@ static void netconfig_ipv4_acd_event(enum l_acd_event event, void *user_data)static void netconfig_ipv4_select_and_install (struct netconfig *netconfig) { -char ip[INET6_ADDRSTRLEN ]; +char ip[INET_ADDRSTRLEN ]; netconfig->v4_address =netconfig_get_static4_address (netconfig); if (netconfig->v4_address &&
Signature · 1 line
2.30.2
Re: [PATCH 3/3] netconfig: Reserve INET_ADDRSTRLEN chars for an IPv4 string
Hi Andrew,
Quoted 7 lines · Andrew Zaborowski
For consistency replace an
INET6_ADDRSTRLENinstance withINET_ADDRSTRLENin a strictly IPv4 context innetconfig_ipv4_select_and_install.--- src/netconfig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
FYI, Coverity (falsely) complains about this when l_rtnl_address_get_address is used with INET_ADDRSTRLEN, since it doesn't know about the family.
Maybe we should make an L_RTNL_* #define for this?
Regards,
-Denis
Hi Andrew,
Quoted 11 lines · Andrew Zaborowski
--- doc/network-configuration-api.txt | 52 +++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+)create mode 100644
doc/network-configuration-api.txtdoc/network-configuration-api.txt new file +0
-0
doc/network-configuration-api.txt line 6
Quoted 6 lines
doc/network-configuration-api.txt new file +6
-0@@ -0,0 +1,52 @@ +Network Configuration hierarchy +=============================== + +Service net.connman.iwd +Interface net.connman.iwd.NetworkConfiguration [Experimental] +Object path /net/connman/iwd/{phy0,phy1,...}/{1,2,...}/{ipv4,ipv6}
Encoding anything into the object path is a discouraged design pattern. You'd be better off instantiating multiple interfaces on the same object instead, one for IPv4 and one for IPv6. That way you could even evolve the IPv4/IPv6 interfaces separately.
Alternatively, you could have a single interface with multiple dictionaries...
doc/network-configuration-api.txt line 9
Quoted 3 lines
doc/network-configuration-api.txt new file +3
-0+Object path /net/connman/iwd/{phy0,phy1,...}/p2p_peers/{aa_bb_cc_dd_ee_ff} + +Properties object Device [readonly]
Given the above, this property would then likely become redundant and could be removed.
Quoted 29 lines
doc/network-configuration-api.txt new file +29
-0+ + The object path of the station, access point or P2P + device that this network configuration is active on. + + In station mode, when network configuration is + enabled there may be one or two objects using this + interface and active on the same device: two if both + IPv4 and IPv6 addresses have been configured. + + In P2P mode, this interface always refers to IPv4 + network configuration. + + string Method [readonly] + + Indicates whether the local address was set + statically (value "static") or obtained automatically + such as through DHCP (value "auto"). Even when the + address was obtained from the remote end some + configuration bits, such as DNS addresses, may have + been overridden locally. + + string Address [readonly] + + Holds the local IP address. + + byte PrefixLength [readonly] + + Holds the prefix-length of the local subnet. For + IPv4 this maps to the netmask.
doc/network-configuration-api.txt line 48
Quoted 10 lines
doc/network-configuration-api.txt new file +10
-0+ + string Gateway [readonly, optional] + + Holds the gateway address for the IPv4 subnet if one + exists. + + array(string) DomainNameServers [readonly, optional] + + Holds the list of domain name servers configured if + any.
Do you need positional information here? Does NM need to know in what order the name servers should be set between IPv6/IPv4?
doc/network-configuration-api.txt line 50
Quoted 2 lines
doc/network-configuration-api.txt new file +2
-0+ + string DomainNames [readonly, optional]
Why DomainNames (plural) when the type is a single string?
doc/network-configuration-api.txt line 52
Quoted 3 lines
doc/network-configuration-api.txt new file +2
-0+ + Holds the network's local domain names if any exist.
Regards,
-Denis