Hi Mohamed,
> add openconnect plugin.
>
> +
> +#ifdef HAVE_CONFIG_H
> +#include <config.h>
> +#endif
> +
> +
> +#include <string.h>
please be more consistent with empty lines. This suppose to be one.
Other times you are adding none where one is needed ;)
> +
> +#define OPENCONNECT_INTF "org.infradead.openconnect"
> +#define OPENCONNECT_PATH "/org/infradead/openconnect"
Using the connman_task infrastructure will give you object path and
interface. No need to duplicate that here.
> +static int kill_tun(char *tun_name)
> +{
> + struct ifreq ifr;
> + int fd, i;
> +
> + memset(&ifr, 0, sizeof(ifr));
> + ifr.ifr_flags = IFF_TUN | IFF_NO_PI;
> + sprintf(ifr.ifr_name, tun_name);
Spaces versus tabs.
> +
> + fd = open("/dev/net/tun", O_RDWR);
> + if (fd < 0) {
> + i = -errno;
> + connman_error("Failed to open /dev/net/tun to kill device %s:
> %s",
> + tun_name, strerror(errno));
> + return i;
> + }
Please don't use i here. That is an iterator variable name. Use err.
> +CONNMAN_PLUGIN_DEFINE(openconnect, "OpenConnect VPN plugin", VERSION,
> + CONNMAN_PLUGIN_PRIORITY_DEFAULT, openconnect_init,
> openconnect_exit)
Couldn't find anything else in the plugin. Just switching to task
infrastructure would make this pretty simple and clean.
> diff --git a/scripts/openconnect-script.c b/scripts/openconnect-script.c
> new file mode 100644
> index 0000000..91a4599
> --- /dev/null
> +++ b/scripts/openconnect-script.c
> @@ -0,0 +1,133 @@
> +#include <dbus/dbus.h>
> +
> +#define OPENCONNECT_INTF "org.infradead.openconnect"
> +#define OPENCONNECT_PATH "/org/infradead/openconnect"
> +
> +extern char **environ;
> +
So it has been argued that we should create a generic script for the
task infrastructure that just returns all command line parameters the
script got called with and its environment. This way it can be used for
VPN and also the DHCP stuff.
Regards
Marcel
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman