Lines Matching refs:rta

864 	struct rtattr *rta;  in addattr_l()  local
872 rta = NLMSG_TAIL(n); in addattr_l()
873 rta->rta_type = type; in addattr_l()
874 rta->rta_len = len; in addattr_l()
876 memcpy(RTA_DATA(rta), data, alen); in addattr_l()
929 int rta_addattr32(struct rtattr *rta, int maxlen, int type, __u32 data) in rta_addattr32() argument
934 if (RTA_ALIGN(rta->rta_len) + len > maxlen) { in rta_addattr32()
940 subrta = (struct rtattr *)(((char *)rta) + RTA_ALIGN(rta->rta_len)); in rta_addattr32()
944 rta->rta_len = NLMSG_ALIGN(rta->rta_len) + len; in rta_addattr32()
948 int rta_addattr_l(struct rtattr *rta, int maxlen, int type, in rta_addattr_l() argument
954 if (RTA_ALIGN(rta->rta_len) + RTA_ALIGN(len) > maxlen) { in rta_addattr_l()
960 subrta = (struct rtattr *)(((char *)rta) + RTA_ALIGN(rta->rta_len)); in rta_addattr_l()
965 rta->rta_len = NLMSG_ALIGN(rta->rta_len) + RTA_ALIGN(len); in rta_addattr_l()
969 int rta_addattr8(struct rtattr *rta, int maxlen, int type, __u8 data) in rta_addattr8() argument
971 return rta_addattr_l(rta, maxlen, type, &data, sizeof(__u8)); in rta_addattr8()
974 int rta_addattr16(struct rtattr *rta, int maxlen, int type, __u16 data) in rta_addattr16() argument
976 return rta_addattr_l(rta, maxlen, type, &data, sizeof(__u16)); in rta_addattr16()
979 int rta_addattr64(struct rtattr *rta, int maxlen, int type, __u64 data) in rta_addattr64() argument
981 return rta_addattr_l(rta, maxlen, type, &data, sizeof(__u64)); in rta_addattr64()
984 struct rtattr *rta_nest(struct rtattr *rta, int maxlen, int type) in rta_nest() argument
986 struct rtattr *nest = RTA_TAIL(rta); in rta_nest()
988 rta_addattr_l(rta, maxlen, type, NULL, 0); in rta_nest()
993 int rta_nest_end(struct rtattr *rta, struct rtattr *nest) in rta_nest_end() argument
995 nest->rta_len = (void *)RTA_TAIL(rta) - (void *)nest; in rta_nest_end()
997 return rta->rta_len; in rta_nest_end()
1000 int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len) in parse_rtattr() argument
1002 return parse_rtattr_flags(tb, max, rta, len, 0); in parse_rtattr()
1005 int parse_rtattr_flags(struct rtattr *tb[], int max, struct rtattr *rta, in parse_rtattr_flags() argument
1011 while (RTA_OK(rta, len)) { in parse_rtattr_flags()
1012 type = rta->rta_type & ~flags; in parse_rtattr_flags()
1014 tb[type] = rta; in parse_rtattr_flags()
1015 rta = RTA_NEXT(rta, len); in parse_rtattr_flags()
1019 len, rta->rta_len); in parse_rtattr_flags()
1024 struct rtattr *rta, int len) in parse_rtattr_byindex() argument
1029 while (RTA_OK(rta, len)) { in parse_rtattr_byindex()
1030 if (rta->rta_type <= max && i < max) in parse_rtattr_byindex()
1031 tb[i++] = rta; in parse_rtattr_byindex()
1032 rta = RTA_NEXT(rta, len); in parse_rtattr_byindex()
1036 len, rta->rta_len); in parse_rtattr_byindex()
1040 struct rtattr *parse_rtattr_one(int type, struct rtattr *rta, int len) in parse_rtattr_one() argument
1042 while (RTA_OK(rta, len)) { in parse_rtattr_one()
1043 if (rta->rta_type == type) in parse_rtattr_one()
1044 return rta; in parse_rtattr_one()
1045 rta = RTA_NEXT(rta, len); in parse_rtattr_one()
1050 len, rta->rta_len); in parse_rtattr_one()
1055 struct rtattr *rta, in __parse_rtattr_nested_compat() argument
1058 if (RTA_PAYLOAD(rta) < len) in __parse_rtattr_nested_compat()
1060 if (RTA_PAYLOAD(rta) >= RTA_ALIGN(len) + sizeof(struct rtattr)) { in __parse_rtattr_nested_compat()
1061 rta = RTA_DATA(rta) + RTA_ALIGN(len); in __parse_rtattr_nested_compat()
1062 return parse_rtattr_nested(tb, max, rta); in __parse_rtattr_nested_compat()