Home | History | Annotate | Download | only in linux

Lines Matching defs:rta

146 #define RTA_OK(rta,len) ((len) >= (int)sizeof(struct rtattr) && \
147 (rta)->rta_len >= sizeof(struct rtattr) && \
148 (rta)->rta_len <= (len))
149 #define RTA_NEXT(rta,attrlen) ((attrlen) -= RTA_ALIGN((rta)->rta_len), \
150 (struct rtattr*)(((char*)(rta)) + RTA_ALIGN((rta)->rta_len)))
153 #define RTA_DATA(rta) ((void*)(((char*)(rta)) + RTA_LENGTH(0)))
154 #define RTA_PAYLOAD(rta) ((int)((rta)->rta_len) - RTA_LENGTH(0))
609 static __inline__ int rtattr_strcmp(const struct rtattr *rta, const char *str)
612 return len > rta->rta_len || memcmp(RTA_DATA(rta), str, len);
696 #define RTA_GET_U8(rta) \
697 ({ if (!rta || RTA_PAYLOAD(rta) < sizeof(u8)) \
699 *(u8 *) RTA_DATA(rta); })
701 #define RTA_GET_U16(rta) \
702 ({ if (!rta || RTA_PAYLOAD(rta) < sizeof(u16)) \
704 *(u16 *) RTA_DATA(rta); })
706 #define RTA_GET_U32(rta) \
707 ({ if (!rta || RTA_PAYLOAD(rta) < sizeof(u32)) \
709 *(u32 *) RTA_DATA(rta); })
711 #define RTA_GET_U64(rta) \
713 if (!rta || RTA_PAYLOAD(rta) < sizeof(u64)) \
715 memcpy(&_tmp, RTA_DATA(rta), sizeof(_tmp)); \
718 #define RTA_GET_FLAG(rta) (!!(rta))
720 #define RTA_GET_SECS(rta) ((unsigned long) RTA_GET_U64(rta) * HZ)
721 #define RTA_GET_MSECS(rta) (msecs_to_jiffies((unsigned long) RTA_GET_U64(rta)))
726 struct rtattr *rta;
729 rta = (struct rtattr*)skb_put(skb, RTA_ALIGN(size));
730 rta->rta_type = attrtype;
731 rta->rta_len = size;
732 memset(RTA_DATA(rta) + attrlen, 0, RTA_ALIGN(size) - size);
733 return rta;
763 static inline u32 rtm_get_table(struct rtattr **rta, u8 table)
765 return RTA_GET_U32(rta[RTA_TABLE-1]);