aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/rtnetlink.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/rtnetlink.h')
-rw-r--r--include/linux/rtnetlink.h191
1 files changed, 189 insertions, 2 deletions
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 91ac97c20777..657c05ab8f9e 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -89,6 +89,13 @@ enum {
89 RTM_GETANYCAST = 62, 89 RTM_GETANYCAST = 62,
90#define RTM_GETANYCAST RTM_GETANYCAST 90#define RTM_GETANYCAST RTM_GETANYCAST
91 91
92 RTM_NEWNEIGHTBL = 64,
93#define RTM_NEWNEIGHTBL RTM_NEWNEIGHTBL
94 RTM_GETNEIGHTBL = 66,
95#define RTM_GETNEIGHTBL RTM_GETNEIGHTBL
96 RTM_SETNEIGHTBL,
97#define RTM_SETNEIGHTBL RTM_SETNEIGHTBL
98
92 __RTM_MAX, 99 __RTM_MAX,
93#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) 100#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1)
94}; 101};
@@ -356,6 +363,8 @@ enum
356struct rta_session 363struct rta_session
357{ 364{
358 __u8 proto; 365 __u8 proto;
366 __u8 pad1;
367 __u16 pad2;
359 368
360 union { 369 union {
361 struct { 370 struct {
@@ -493,6 +502,106 @@ struct nda_cacheinfo
493 __u32 ndm_refcnt; 502 __u32 ndm_refcnt;
494}; 503};
495 504
505
506/*****************************************************************
507 * Neighbour tables specific messages.
508 *
509 * To retrieve the neighbour tables send RTM_GETNEIGHTBL with the
510 * NLM_F_DUMP flag set. Every neighbour table configuration is
511 * spread over multiple messages to avoid running into message
512 * size limits on systems with many interfaces. The first message
513 * in the sequence transports all not device specific data such as
514 * statistics, configuration, and the default parameter set.
515 * This message is followed by 0..n messages carrying device
516 * specific parameter sets.
517 * Although the ordering should be sufficient, NDTA_NAME can be
518 * used to identify sequences. The initial message can be identified
519 * by checking for NDTA_CONFIG. The device specific messages do
520 * not contain this TLV but have NDTPA_IFINDEX set to the
521 * corresponding interface index.
522 *
523 * To change neighbour table attributes, send RTM_SETNEIGHTBL
524 * with NDTA_NAME set. Changeable attribute include NDTA_THRESH[1-3],
525 * NDTA_GC_INTERVAL, and all TLVs in NDTA_PARMS unless marked
526 * otherwise. Device specific parameter sets can be changed by
527 * setting NDTPA_IFINDEX to the interface index of the corresponding
528 * device.
529 ****/
530
531struct ndt_stats
532{
533 __u64 ndts_allocs;
534 __u64 ndts_destroys;
535 __u64 ndts_hash_grows;
536 __u64 ndts_res_failed;
537 __u64 ndts_lookups;
538 __u64 ndts_hits;
539 __u64 ndts_rcv_probes_mcast;
540 __u64 ndts_rcv_probes_ucast;
541 __u64 ndts_periodic_gc_runs;
542 __u64 ndts_forced_gc_runs;
543};
544
545enum {
546 NDTPA_UNSPEC,
547 NDTPA_IFINDEX, /* u32, unchangeable */
548 NDTPA_REFCNT, /* u32, read-only */
549 NDTPA_REACHABLE_TIME, /* u64, read-only, msecs */
550 NDTPA_BASE_REACHABLE_TIME, /* u64, msecs */
551 NDTPA_RETRANS_TIME, /* u64, msecs */
552 NDTPA_GC_STALETIME, /* u64, msecs */
553 NDTPA_DELAY_PROBE_TIME, /* u64, msecs */
554 NDTPA_QUEUE_LEN, /* u32 */
555 NDTPA_APP_PROBES, /* u32 */
556 NDTPA_UCAST_PROBES, /* u32 */
557 NDTPA_MCAST_PROBES, /* u32 */
558 NDTPA_ANYCAST_DELAY, /* u64, msecs */
559 NDTPA_PROXY_DELAY, /* u64, msecs */
560 NDTPA_PROXY_QLEN, /* u32 */
561 NDTPA_LOCKTIME, /* u64, msecs */
562 __NDTPA_MAX
563};
564#define NDTPA_MAX (__NDTPA_MAX - 1)
565
566struct ndtmsg
567{
568 __u8 ndtm_family;
569 __u8 ndtm_pad1;
570 __u16 ndtm_pad2;
571};
572
573struct ndt_config
574{
575 __u16 ndtc_key_len;
576 __u16 ndtc_entry_size;
577 __u32 ndtc_entries;
578 __u32 ndtc_last_flush; /* delta to now in msecs */
579 __u32 ndtc_last_rand; /* delta to now in msecs */
580 __u32 ndtc_hash_rnd;
581 __u32 ndtc_hash_mask;
582 __u32 ndtc_hash_chain_gc;
583 __u32 ndtc_proxy_qlen;
584};
585
586enum {
587 NDTA_UNSPEC,
588 NDTA_NAME, /* char *, unchangeable */
589 NDTA_THRESH1, /* u32 */
590 NDTA_THRESH2, /* u32 */
591 NDTA_THRESH3, /* u32 */
592 NDTA_CONFIG, /* struct ndt_config, read-only */
593 NDTA_PARMS, /* nested TLV NDTPA_* */
594 NDTA_STATS, /* struct ndt_stats, read-only */
595 NDTA_GC_INTERVAL, /* u64, msecs */
596 __NDTA_MAX
597};
598#define NDTA_MAX (__NDTA_MAX - 1)
599
600#define NDTA_RTA(r) ((struct rtattr*)(((char*)(r)) + \
601 NLMSG_ALIGN(sizeof(struct ndtmsg))))
602#define NDTA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ndtmsg))
603
604
496/**** 605/****
497 * General form of address family dependent message. 606 * General form of address family dependent message.
498 ****/ 607 ****/
@@ -528,10 +637,13 @@ struct ifinfomsg
528struct prefixmsg 637struct prefixmsg
529{ 638{
530 unsigned char prefix_family; 639 unsigned char prefix_family;
640 unsigned char prefix_pad1;
641 unsigned short prefix_pad2;
531 int prefix_ifindex; 642 int prefix_ifindex;
532 unsigned char prefix_type; 643 unsigned char prefix_type;
533 unsigned char prefix_len; 644 unsigned char prefix_len;
534 unsigned char prefix_flags; 645 unsigned char prefix_flags;
646 unsigned char prefix_pad3;
535}; 647};
536 648
537enum 649enum
@@ -785,10 +897,84 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi
785 goto rtattr_failure; \ 897 goto rtattr_failure; \
786 __rta_fill(skb, attrtype, attrlen, data); }) 898 __rta_fill(skb, attrtype, attrlen, data); })
787 899
788#define RTA_PUT_NOHDR(skb, attrlen, data) \ 900#define RTA_APPEND(skb, attrlen, data) \
789({ if (unlikely(skb_tailroom(skb) < (int)(attrlen))) \ 901({ if (unlikely(skb_tailroom(skb) < (int)(attrlen))) \
790 goto rtattr_failure; \ 902 goto rtattr_failure; \
791 memcpy(skb_put(skb, RTA_ALIGN(attrlen)), data, attrlen); }) 903 memcpy(skb_put(skb, attrlen), data, attrlen); })
904
905#define RTA_PUT_NOHDR(skb, attrlen, data) \
906({ RTA_APPEND(skb, RTA_ALIGN(attrlen), data); \
907 memset(skb->tail - (RTA_ALIGN(attrlen) - attrlen), 0, \
908 RTA_ALIGN(attrlen) - attrlen); })
909
910#define RTA_PUT_U8(skb, attrtype, value) \
911({ u8 _tmp = (value); \
912 RTA_PUT(skb, attrtype, sizeof(u8), &_tmp); })
913
914#define RTA_PUT_U16(skb, attrtype, value) \
915({ u16 _tmp = (value); \
916 RTA_PUT(skb, attrtype, sizeof(u16), &_tmp); })
917
918#define RTA_PUT_U32(skb, attrtype, value) \
919({ u32 _tmp = (value); \
920 RTA_PUT(skb, attrtype, sizeof(u32), &_tmp); })
921
922#define RTA_PUT_U64(skb, attrtype, value) \
923({ u64 _tmp = (value); \
924 RTA_PUT(skb, attrtype, sizeof(u64), &_tmp); })
925
926#define RTA_PUT_SECS(skb, attrtype, value) \
927 RTA_PUT_U64(skb, attrtype, (value) / HZ)
928
929#define RTA_PUT_MSECS(skb, attrtype, value) \
930 RTA_PUT_U64(skb, attrtype, jiffies_to_msecs(value))
931
932#define RTA_PUT_STRING(skb, attrtype, value) \
933 RTA_PUT(skb, attrtype, strlen(value) + 1, value)
934
935#define RTA_PUT_FLAG(skb, attrtype) \
936 RTA_PUT(skb, attrtype, 0, NULL);
937
938#define RTA_NEST(skb, type) \
939({ struct rtattr *__start = (struct rtattr *) (skb)->tail; \
940 RTA_PUT(skb, type, 0, NULL); \
941 __start; })
942
943#define RTA_NEST_END(skb, start) \
944({ (start)->rta_len = ((skb)->tail - (unsigned char *) (start)); \
945 (skb)->len; })
946
947#define RTA_NEST_CANCEL(skb, start) \
948({ if (start) \
949 skb_trim(skb, (unsigned char *) (start) - (skb)->data); \
950 -1; })
951
952#define RTA_GET_U8(rta) \
953({ if (!rta || RTA_PAYLOAD(rta) < sizeof(u8)) \
954 goto rtattr_failure; \
955 *(u8 *) RTA_DATA(rta); })
956
957#define RTA_GET_U16(rta) \
958({ if (!rta || RTA_PAYLOAD(rta) < sizeof(u16)) \
959 goto rtattr_failure; \
960 *(u16 *) RTA_DATA(rta); })
961
962#define RTA_GET_U32(rta) \
963({ if (!rta || RTA_PAYLOAD(rta) < sizeof(u32)) \
964 goto rtattr_failure; \
965 *(u32 *) RTA_DATA(rta); })
966
967#define RTA_GET_U64(rta) \
968({ u64 _tmp; \
969 if (!rta || RTA_PAYLOAD(rta) < sizeof(u64)) \
970 goto rtattr_failure; \
971 memcpy(&_tmp, RTA_DATA(rta), sizeof(_tmp)); \
972 _tmp; })
973
974#define RTA_GET_FLAG(rta) (!!(rta))
975
976#define RTA_GET_SECS(rta) ((unsigned long) RTA_GET_U64(rta) * HZ)
977#define RTA_GET_MSECS(rta) (msecs_to_jiffies((unsigned long) RTA_GET_U64(rta)))
792 978
793static inline struct rtattr * 979static inline struct rtattr *
794__rta_reserve(struct sk_buff *skb, int attrtype, int attrlen) 980__rta_reserve(struct sk_buff *skb, int attrtype, int attrlen)
@@ -799,6 +985,7 @@ __rta_reserve(struct sk_buff *skb, int attrtype, int attrlen)
799 rta = (struct rtattr*)skb_put(skb, RTA_ALIGN(size)); 985 rta = (struct rtattr*)skb_put(skb, RTA_ALIGN(size));
800 rta->rta_type = attrtype; 986 rta->rta_type = attrtype;
801 rta->rta_len = size; 987 rta->rta_len = size;
988 memset(RTA_DATA(rta) + attrlen, 0, RTA_ALIGN(size) - size);
802 return rta; 989 return rta;
803} 990}
804 991