Re: How to find BSD name for PPP interface
Re: How to find BSD name for PPP interface
- Subject: Re: How to find BSD name for PPP interface
- From: Allan Nathanson <email@hidden>
- Date: Mon, 29 Jan 2007 17:14:04 -0500
On Jan 29, 2007, at 11:20 AM, Peter Sichel wrote:
On 1/29/07, Allan Nathanson wrote:
When active, look in the State:/Network/Service/<serviceID>/IPv4
entity. There, you should find an
"InterfaceName" (kSCPropInterfaceName) key whose value is the
interface name associated with the service.
Thanks for your quick response. If I understand, the InterfaceName is
not known until PPP connects and may change from one connection to
the next.
Correct. In fact, the reason that you'll find the InterfaceName in
the State:/Network/Service/<serviceID>/IPv4 entity is because we also
wanted to know the association between the <service> and the
<interface>.
The problem I want to resolve is how to present the user with a
configuration option to specify which interface(s) to apply some
attributes to using an NKE. Since the BSD device name may be unknown
until the user connects, any configuration to be applied needs to be
associated with some other description of the interface.
When my program detects that a new data link has appeared by listening
for the kernel event notification, I then need to figure out whether
to
attach my NKE to that interface, and what attributes to apply.
So if the kernel informs me that a device named "ppp1" has appeared
(KEV_DL_IF_ATTACHED), I could then walk the list of serviceIDs to see
which (if any) was associated with that device.
What unique name would you suggest I present to the user to associate
their configuration with that interface when it appears? Should I use
the kSCPropUserDefinedName for that serviceID?
Will this normally exist and be unique? What if the user creates a
data
link using some BSD tool directly (like "tun0")? Will this create a
State:/Network/Service/<serviceID>/IPv4 entity with some user
recognizable name?
I would expect any UI to present a list of services to the user. The
"user friendly" identifier associated with a given service will
typically be the service name which you can get using the
SCNetworkServiceGetName() API (or look for the kSCPropUserDefinedName
key in the SCDynamicStore). If the service doesn't have an associated
name and it's not a connection-oriented service like PPP you can grab
the associated SCNetworkInterface and then display the [localized]
name of the interface. The fallback is to display the serviceID.
Re: the kSCPropUserDefinedName...
The name will generally be unique and we even try to enforce that in
the SCNetworkServiceSetName() API but it's not a sure thing. In
addition, the property may not even exist (for localization reasons
we're leaning towards not setting the name if it matches the name of
the associated service).
Re: an interface created behind the scenes...
The current UI is all "service"-centric in that we only display and
configuration information about "services". The exception is that we
provide UI to create/manage Bond & VLAN interfaces (and once you have
the interface you can then configure a service with that interface).
Re: suggestions on how to identify which interfaces are important to
your NKE...
I'd suggest that you let the user select the services of interest and
track that interest either by keeping a list of the <serviceID>s or by
adding a key/value to one of the configuration entities associated
with the service. Then, when a service is started you can check if
its one that your NKE should care about.
- Allan
_______________________________________________
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