Witam!
Mam pewien problem ze wskażnikiem w funkcji wziętej z biblioteki netlink:
int addattr_l(struct nlmsghdr *n, int maxlen, int type, const void *data, int alen) {
int len = RTA_LENGTH(alen);
struct rtattr *rta;
if (NLMSG_ALIGN(n->nlmsg_len) + RTA_ALIGN(len) > maxlen) {
fprintf(stderr, "addattr_l ERROR: message exceeded bound of %d\n",maxlen);
return -1;
}
rta = NLMSG_TAIL(n);
rta->rta_type = type;
rta->rta_len = len;
memcpy(RTA_DATA(rta), data, alen);
n->nlmsg_len = NLMSG_ALIGN(n->nlmsg_len) + RTA_ALIGN(len);
return 0;
}
błąd generuje linijka:
rta = NLMSG_TAIL(n);
a brzmi on tak:
Warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
Wygląda mi to na nieprawidłowy format przypisywanej wartości do wskaźnika, ale próby konwersji czy też wprowadzania dodatkowych wskaźników nic tutaj nie dają. Co ciekawe ta sama funkcja pod Windowsem działa prawidłowo, ale pod Linuxem już nie :( Może ktoś z was ma jakiś pomysł? Pilne!