}
static int vxcan_parse_opt(struct link_util *lu, int argc, char **argv,
- struct nlmsghdr *hdr)
+ struct nlmsghdr *n)
{
char *dev = NULL;
char *name = NULL;
return -1;
}
- ifm = NLMSG_DATA(hdr);
+ ifm = NLMSG_DATA(n);
ifi_flags = ifm->ifi_flags;
ifi_change = ifm->ifi_change;
ifm->ifi_flags = 0;
ifm->ifi_change = 0;
- data = NLMSG_TAIL(hdr);
- addattr_l(hdr, 1024, VXCAN_INFO_PEER, NULL, 0);
+ data = NLMSG_TAIL(n);
+ addattr_l(n, 1024, VXCAN_INFO_PEER, NULL, 0);
- hdr->nlmsg_len += sizeof(struct ifinfomsg);
+ n->nlmsg_len += sizeof(struct ifinfomsg);
- err = iplink_parse(argc - 1, argv + 1, (struct iplink_req *)hdr,
+ err = iplink_parse(argc - 1, argv + 1, (struct iplink_req *)n,
&name, &type, &link, &dev, &group, &index);
if (err < 0)
return err;
duparg("type", argv[err]);
if (name) {
- addattr_l(hdr, 1024,
+ addattr_l(n, 1024,
IFLA_IFNAME, name, strlen(name) + 1);
}
ifm->ifi_change = ifi_change;
if (group != -1)
- addattr32(hdr, 1024, IFLA_GROUP, group);
+ addattr32(n, 1024, IFLA_GROUP, group);
- data->rta_len = (void *)NLMSG_TAIL(hdr) - (void *)data;
+ data->rta_len = (void *)NLMSG_TAIL(n) - (void *)data;
return argc - 1 - err;
}
}
static int macsec_parse_opt(struct link_util *lu, int argc, char **argv,
- struct nlmsghdr *hdr)
+ struct nlmsghdr *n)
{
int ret;
__u8 encoding_sa = 0xff;
if (ret > 0) {
if (sci.sci)
- addattr_l(hdr, MACSEC_BUFLEN, IFLA_MACSEC_SCI,
+ addattr_l(n, MACSEC_BUFLEN, IFLA_MACSEC_SCI,
&sci.sci, sizeof(sci.sci));
else
- addattr_l(hdr, MACSEC_BUFLEN, IFLA_MACSEC_PORT,
+ addattr_l(n, MACSEC_BUFLEN, IFLA_MACSEC_PORT,
&sci.port, sizeof(sci.port));
}
ARRAY_SIZE(values_on_off), &i);
if (ret != 0)
return ret;
- addattr8(hdr, MACSEC_BUFLEN, IFLA_MACSEC_ENCRYPT, i);
+ addattr8(n, MACSEC_BUFLEN, IFLA_MACSEC_ENCRYPT, i);
} else if (strcmp(*argv, "send_sci") == 0) {
NEXT_ARG();
int i;
if (ret != 0)
return ret;
send_sci = i;
- addattr8(hdr, MACSEC_BUFLEN,
+ addattr8(n, MACSEC_BUFLEN,
IFLA_MACSEC_INC_SCI, send_sci);
} else if (strcmp(*argv, "end_station") == 0) {
NEXT_ARG();
if (ret != 0)
return ret;
es = i;
- addattr8(hdr, MACSEC_BUFLEN, IFLA_MACSEC_ES, es);
+ addattr8(n, MACSEC_BUFLEN, IFLA_MACSEC_ES, es);
} else if (strcmp(*argv, "scb") == 0) {
NEXT_ARG();
int i;
if (ret != 0)
return ret;
scb = i;
- addattr8(hdr, MACSEC_BUFLEN, IFLA_MACSEC_SCB, scb);
+ addattr8(n, MACSEC_BUFLEN, IFLA_MACSEC_SCB, scb);
} else if (strcmp(*argv, "protect") == 0) {
NEXT_ARG();
int i;
ARRAY_SIZE(values_on_off), &i);
if (ret != 0)
return ret;
- addattr8(hdr, MACSEC_BUFLEN, IFLA_MACSEC_PROTECT, i);
+ addattr8(n, MACSEC_BUFLEN, IFLA_MACSEC_PROTECT, i);
} else if (strcmp(*argv, "replay") == 0) {
NEXT_ARG();
int i;
(int *)&validate);
if (ret != 0)
return ret;
- addattr8(hdr, MACSEC_BUFLEN,
+ addattr8(n, MACSEC_BUFLEN,
IFLA_MACSEC_VALIDATION, validate);
} else if (strcmp(*argv, "encodingsa") == 0) {
if (encoding_sa != 0xff)
}
if (cipher.id)
- addattr_l(hdr, MACSEC_BUFLEN, IFLA_MACSEC_CIPHER_SUITE,
+ addattr_l(n, MACSEC_BUFLEN, IFLA_MACSEC_CIPHER_SUITE,
&cipher.id, sizeof(cipher.id));
if (cipher.icv_len)
- addattr_l(hdr, MACSEC_BUFLEN, IFLA_MACSEC_ICV_LEN,
+ addattr_l(n, MACSEC_BUFLEN, IFLA_MACSEC_ICV_LEN,
&cipher.icv_len, sizeof(cipher.icv_len));
if (replay_protect != -1) {
- addattr32(hdr, MACSEC_BUFLEN, IFLA_MACSEC_WINDOW, window);
- addattr8(hdr, MACSEC_BUFLEN, IFLA_MACSEC_REPLAY_PROTECT,
+ addattr32(n, MACSEC_BUFLEN, IFLA_MACSEC_WINDOW, window);
+ addattr8(n, MACSEC_BUFLEN, IFLA_MACSEC_REPLAY_PROTECT,
replay_protect);
}
if (encoding_sa != 0xff) {
- addattr_l(hdr, MACSEC_BUFLEN, IFLA_MACSEC_ENCODING_SA,
+ addattr_l(n, MACSEC_BUFLEN, IFLA_MACSEC_ENCODING_SA,
&encoding_sa, sizeof(encoding_sa));
}
static int gre_parse_opt(struct link_util *lu, int argc, char **argv,
struct nlmsghdr *n)
{
- struct ifinfomsg *ifi = (struct ifinfomsg *)(n + 1);
+ struct ifinfomsg *ifi = NLMSG_DATA(n);
struct {
struct nlmsghdr n;
struct ifinfomsg i;
static int gre_parse_opt(struct link_util *lu, int argc, char **argv,
struct nlmsghdr *n)
{
- struct ifinfomsg *ifi = (struct ifinfomsg *)(n + 1);
+ struct ifinfomsg *ifi = NLMSG_DATA(n);
struct {
struct nlmsghdr n;
struct ifinfomsg i;
static int ip6tunnel_parse_opt(struct link_util *lu, int argc, char **argv,
struct nlmsghdr *n)
{
- struct ifinfomsg *ifi = (struct ifinfomsg *)(n + 1);
+ struct ifinfomsg *ifi = NLMSG_DATA(n);
struct {
struct nlmsghdr n;
struct ifinfomsg i;
static int iptunnel_parse_opt(struct link_util *lu, int argc, char **argv,
struct nlmsghdr *n)
{
- struct ifinfomsg *ifi = (struct ifinfomsg *)(n + 1);
+ struct ifinfomsg *ifi = NLMSG_DATA(n);
struct {
struct nlmsghdr n;
struct ifinfomsg i;
}
static int veth_parse_opt(struct link_util *lu, int argc, char **argv,
- struct nlmsghdr *hdr)
+ struct nlmsghdr *n)
{
char *dev = NULL;
char *name = NULL;
return -1;
}
- ifm = NLMSG_DATA(hdr);
+ ifm = NLMSG_DATA(n);
ifi_flags = ifm->ifi_flags;
ifi_change = ifm->ifi_change;
ifm->ifi_flags = 0;
ifm->ifi_change = 0;
- data = NLMSG_TAIL(hdr);
- addattr_l(hdr, 1024, VETH_INFO_PEER, NULL, 0);
+ data = NLMSG_TAIL(n);
+ addattr_l(n, 1024, VETH_INFO_PEER, NULL, 0);
- hdr->nlmsg_len += sizeof(struct ifinfomsg);
+ n->nlmsg_len += sizeof(struct ifinfomsg);
- err = iplink_parse(argc - 1, argv + 1, (struct iplink_req *)hdr,
+ err = iplink_parse(argc - 1, argv + 1, (struct iplink_req *)n,
&name, &type, &link, &dev, &group, &index);
if (err < 0)
return err;
duparg("type", argv[err]);
if (name) {
- addattr_l(hdr, 1024,
+ addattr_l(n, 1024,
IFLA_IFNAME, name, strlen(name) + 1);
}
ifm->ifi_change = ifi_change;
if (group != -1)
- addattr32(hdr, 1024, IFLA_GROUP, group);
+ addattr32(n, 1024, IFLA_GROUP, group);
- data->rta_len = (void *)NLMSG_TAIL(hdr) - (void *)data;
+ data->rta_len = (void *)NLMSG_TAIL(n) - (void *)data;
return argc - 1 - err;
}
static int vti_parse_opt(struct link_util *lu, int argc, char **argv,
struct nlmsghdr *n)
{
- struct ifinfomsg *ifi = (struct ifinfomsg *)(n + 1);
+ struct ifinfomsg *ifi = NLMSG_DATA(n);
struct {
struct nlmsghdr n;
struct ifinfomsg i;
static int vti6_parse_opt(struct link_util *lu, int argc, char **argv,
struct nlmsghdr *n)
{
- struct ifinfomsg *ifi = (struct ifinfomsg *)(n + 1);
+ struct ifinfomsg *ifi = NLMSG_DATA(n);
struct {
struct nlmsghdr n;
struct ifinfomsg i;