diff options
Diffstat (limited to 'include/linux/rtnetlink.h')
-rw-r--r-- | include/linux/rtnetlink.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index 6fff8c4c99c7..e68dbf0bf579 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h | |||
@@ -897,6 +897,14 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi | |||
897 | goto rtattr_failure; \ | 897 | goto rtattr_failure; \ |
898 | memcpy(skb_put(skb, RTA_ALIGN(attrlen)), data, attrlen); }) | 898 | memcpy(skb_put(skb, RTA_ALIGN(attrlen)), data, attrlen); }) |
899 | 899 | ||
900 | #define RTA_PUT_U8(skb, attrtype, value) \ | ||
901 | ({ u8 _tmp = (value); \ | ||
902 | RTA_PUT(skb, attrtype, sizeof(u8), &_tmp); }) | ||
903 | |||
904 | #define RTA_PUT_U16(skb, attrtype, value) \ | ||
905 | ({ u16 _tmp = (value); \ | ||
906 | RTA_PUT(skb, attrtype, sizeof(u16), &_tmp); }) | ||
907 | |||
900 | #define RTA_PUT_U32(skb, attrtype, value) \ | 908 | #define RTA_PUT_U32(skb, attrtype, value) \ |
901 | ({ u32 _tmp = (value); \ | 909 | ({ u32 _tmp = (value); \ |
902 | RTA_PUT(skb, attrtype, sizeof(u32), &_tmp); }) | 910 | RTA_PUT(skb, attrtype, sizeof(u32), &_tmp); }) |
@@ -914,6 +922,9 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi | |||
914 | #define RTA_PUT_STRING(skb, attrtype, value) \ | 922 | #define RTA_PUT_STRING(skb, attrtype, value) \ |
915 | RTA_PUT(skb, attrtype, strlen(value) + 1, value) | 923 | RTA_PUT(skb, attrtype, strlen(value) + 1, value) |
916 | 924 | ||
925 | #define RTA_PUT_FLAG(skb, attrtype) \ | ||
926 | RTA_PUT(skb, attrtype, 0, NULL); | ||
927 | |||
917 | #define RTA_NEST(skb, type) \ | 928 | #define RTA_NEST(skb, type) \ |
918 | ({ struct rtattr *__start = (struct rtattr *) (skb)->tail; \ | 929 | ({ struct rtattr *__start = (struct rtattr *) (skb)->tail; \ |
919 | RTA_PUT(skb, type, 0, NULL); \ | 930 | RTA_PUT(skb, type, 0, NULL); \ |
@@ -928,6 +939,16 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi | |||
928 | skb_trim(skb, (unsigned char *) (start) - (skb)->data); \ | 939 | skb_trim(skb, (unsigned char *) (start) - (skb)->data); \ |
929 | -1; }) | 940 | -1; }) |
930 | 941 | ||
942 | #define RTA_GET_U8(rta) \ | ||
943 | ({ if (!rta || RTA_PAYLOAD(rta) < sizeof(u8)) \ | ||
944 | goto rtattr_failure; \ | ||
945 | *(u8 *) RTA_DATA(rta); }) | ||
946 | |||
947 | #define RTA_GET_U16(rta) \ | ||
948 | ({ if (!rta || RTA_PAYLOAD(rta) < sizeof(u16)) \ | ||
949 | goto rtattr_failure; \ | ||
950 | *(u16 *) RTA_DATA(rta); }) | ||
951 | |||
931 | #define RTA_GET_U32(rta) \ | 952 | #define RTA_GET_U32(rta) \ |
932 | ({ if (!rta || RTA_PAYLOAD(rta) < sizeof(u32)) \ | 953 | ({ if (!rta || RTA_PAYLOAD(rta) < sizeof(u32)) \ |
933 | goto rtattr_failure; \ | 954 | goto rtattr_failure; \ |
@@ -940,6 +961,8 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi | |||
940 | memcpy(&_tmp, RTA_DATA(rta), sizeof(_tmp)); \ | 961 | memcpy(&_tmp, RTA_DATA(rta), sizeof(_tmp)); \ |
941 | _tmp; }) | 962 | _tmp; }) |
942 | 963 | ||
964 | #define RTA_GET_FLAG(rta) (!!(rta)) | ||
965 | |||
943 | #define RTA_GET_SECS(rta) ((unsigned long) RTA_GET_U64(rta) * HZ) | 966 | #define RTA_GET_SECS(rta) ((unsigned long) RTA_GET_U64(rta) * HZ) |
944 | #define RTA_GET_MSECS(rta) (msecs_to_jiffies((unsigned long) RTA_GET_U64(rta))) | 967 | #define RTA_GET_MSECS(rta) (msecs_to_jiffies((unsigned long) RTA_GET_U64(rta))) |
945 | 968 | ||