Hi Sjur,

>  Makefile.am                  |    2 +
>  drivers/stemodem/caif_rtnl.c |  340 
> ++++++++++++++++++++++++++++++++++++++++++
>  drivers/stemodem/caif_rtnl.h |   29 ++++
>  3 files changed, 371 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/stemodem/caif_rtnl.c
>  create mode 100644 drivers/stemodem/caif_rtnl.h

I applied this patch now, but I had to fix this up a bit. You have to
send a patch that updates this one.

> +#define RTNL_MSG_SIZE 4096
> +
> +struct rtnl_msg {
> +     struct nlmsghdr n;
> +     struct ifinfomsg i;
> +     char data[RTNL_MSG_SIZE];
> +};

Is this not a bit big?

> +struct iplink_req {
> +     guint32 rtnlmsg_seqnr;

Use the proper nlmsg_seqnr type that you get from RTNL.

> +     gpointer user_data;

Use void * here since your callback does as well.

> +     caif_rtnl_create_cb_t callback;
> +};
> +
> +static GSList *pending_requests;
> +static guint32 rtnl_seqnr;
> +static guint rtnl_watch;
> +static GIOChannel *rtnl_channel;
> +
> +static struct iplink_req *find_request(guint32 seq)
> +{

seq should match RTNL given type.

> +     GSList *list;
> +
> +     for (list = pending_requests; list; list = list->next) {
> +             struct iplink_req *req = list->data;
> +
> +             if (req->rtnlmsg_seqnr == seq)
> +                     return req;
> +     }
> +
> +     return NULL;
> +}
> +
> +static void parse_newlink_param(struct ifinfomsg *msg, int size,
> +                                             int *ifindex, char *ifname)
> +{
> +     struct rtattr *attr;
> +
> +     for (attr = IFLA_RTA(msg); RTA_OK(attr, size);
> +             attr = RTA_NEXT(attr, size)) {
> +
> +             if (attr->rta_type == IFLA_IFNAME &&
> +                             ifname != NULL) {
> +
> +                     strncpy(ifname, RTA_DATA(attr), IF_NAMESIZE);
> +                     ifname[IF_NAMESIZE-1] = '\0';
> +                     break;
> +             }
> +     }
> +
> +     *ifindex = msg->ifi_index;
> +}
> +
> +static void parse_rtnl_message(const void *buf, size_t len)
> +{
> +     struct ifinfomsg *msg;
> +     struct iplink_req *req = NULL;

This is bad. Please only do assignment if there is no other way around
it. I fixed this for you.

Regards

Marcel


_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to