[SystemConfiguration] How to be informed when the router IP address is available/known
[SystemConfiguration] How to be informed when the router IP address is available/known
- Subject: [SystemConfiguration] How to be informed when the router IP address is available/known
- From: Stéphane Sudre <email@hidden>
- Date: Tue, 29 May 2012 16:14:14 +0200
Problem:
--------
When the System Configuration framework notifies of a change for the
kSCEntNetIPv4 global entity, the router IP address is not set and no
later notifications are performed.
Discussion:
-----------
I'm looking into finding the router IP address attached to the primary
IPv4 (and IPv6) configuration.
I registered as an observer for the kSCEntNetIPv4 (and kSCEntNetIPv6)
global entities.
Depending on the configuration method (Manual or not), I use different
code to get the router IP address.
In the case of a manual IPv4 configuration, I check the value
associated to the kSCPropNetIPv4Router key.
The issue is that this value is not always set when the
SCDynamicStoreCallBack is invoked.
And no other notifications are sent later when the Router IP address
is set for the kSCPropNetIPv4Router key.
Example:
--------
In the System Preferences > Network pane, the Ethernet interface is
configured manually with these very original values:
IP Address: 192.168.1.1
Subnet Mask: 255.255.255.0
Router: 192.168.1.251
1. You set an empty string for "Router" and then click apply.
=> The SCDynamicStoreCallBack callback is invoked. OK fine.
2. You set 192.168.1.251 for "Router" and then click apply.
=> The SCDynamicStoreCallBack callback is invoked. But the
kSCPropNetIPv4Router is not set. Would you wait a bit before looking
for this key, you would get a result.
Question:
---------
Is there a way to be notified when the kSCPropNetIPv4Router key is
changed?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden