Hi Jonathan,

> > > I am trying to implement the offline mode for a connman plugin. It
> > seems
> > > that when installing connman (through make install with a configure
> > in /usr)
> > > the file service.h is not deployed in /usr/include/connman, and this
> > file is
> > > required by notifier.h.
> > 
> > I did fix the includes now. However I am not sure if you are trying to
> > misuse the notifier framework. All drivers get proper callbacks for
> > switching themselves off.
> > 
> 
> I might be misusing the notifier framework. In my plugin, I want to be
> alerted when connman is asked to go "Offline", the only way I found is to
> declare and register a notifier such as:
> 
> static struct connman_notifier telephony_notifier = {
>       .name           = "telephony",
>       .priority       = CONNMAN_NOTIFIER_PRIORITY_DEFAULT,
>       .service_enabled= telephony_service_enabled,
>       .offline_mode   = telephony_offline_mode,
> };
> 
> So that when Connman "Offline" property change, I can execute some code.
> Is that OK ?

if you have a struct device you are getting a disable callback when
offline mode is triggered. So why you are using the notifier framework?

The notifier framework is more for external entities like OSPM etc.

> I am also using some other functions to set an IPV4 static configuration
> such as (I could not make a static IP configuration work with ip_config):
> connman_inet_set_address(index, ip, netmask, broadcast);
> connman_inet_set_gateway(index, gw);
> connman_resolver_append(interface_name, NULL, dns_addr);

You can not mess with the default gateway. Setting the address is not a
good idea, but also not a big problem, but changing the default gateway
is. That is fully up to connmand to decide which service gets the
default route.

The resolver function is officially there for adding resolvers on a per
interface basis. Remember to remove them when the interface goes away or
the device gets disabled.

As a rule of thumb, you should only set/assign things for your interface
and not global ones. The default gateway is a global option.

> Are these subject to change a lot in next connman revisions, Is it OK to
> assign an IPv4 static configuration to a network interface using these ?

They might change a little bit. We wanna establish struct ipconfig to
make things easier and more common. Especially handling all the RTNL
tracking in the background.

Regards

Marcel


_______________________________________________
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman

Reply via email to