• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * netlink-private/types.h	Netlink Types (Private)
3  *
4  *	This library is free software; you can redistribute it and/or
5  *	modify it under the terms of the GNU Lesser General Public
6  *	License as published by the Free Software Foundation version 2.1
7  *	of the License.
8  *
9  * Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch>
10  * Copyright (c) 2013 Sassano Systems LLC <joe@sassanosystems.com>
11  */
12 
13 #ifndef NETLINK_LOCAL_TYPES_H_
14 #define NETLINK_LOCAL_TYPES_H_
15 
16 #include <netlink/list.h>
17 #include <netlink/route/link.h>
18 #include <netlink/route/qdisc.h>
19 #include <netlink/route/rtnl.h>
20 #include <netlink/route/route.h>
21 #include <netlink/idiag/idiagnl.h>
22 #include <netlink/netfilter/ct.h>
23 #include <netlink-private/route/tc-api.h>
24 #include <linux/tc_act/tc_mirred.h>
25 
26 #define NL_SOCK_BUFSIZE_SET	(1<<0)
27 #define NL_SOCK_PASSCRED	(1<<1)
28 #define NL_OWN_PORT		(1<<2)
29 #define NL_MSG_PEEK		(1<<3)
30 #define NL_NO_AUTO_ACK		(1<<4)
31 
32 #define NL_MSG_CRED_PRESENT 1
33 
34 struct nl_cache_ops;
35 struct nl_sock;
36 struct nl_object;
37 struct nl_hash_table;
38 
39 struct nl_cb
40 {
41 	nl_recvmsg_msg_cb_t	cb_set[NL_CB_TYPE_MAX+1];
42 	void *			cb_args[NL_CB_TYPE_MAX+1];
43 
44 	nl_recvmsg_err_cb_t	cb_err;
45 	void *			cb_err_arg;
46 
47 	/** May be used to replace nl_recvmsgs with your own implementation
48 	 * in all internal calls to nl_recvmsgs. */
49 	int			(*cb_recvmsgs_ow)(struct nl_sock *,
50 						  struct nl_cb *);
51 
52 	/** Overwrite internal calls to nl_recv, must return the number of
53 	 * octets read and allocate a buffer for the received data. */
54 	int			(*cb_recv_ow)(struct nl_sock *,
55 					      struct sockaddr_nl *,
56 					      unsigned char **,
57 					      struct ucred **);
58 
59 	/** Overwrites internal calls to nl_send, must send the netlink
60 	 * message. */
61 	int			(*cb_send_ow)(struct nl_sock *,
62 					      struct nl_msg *);
63 
64 	int			cb_refcnt;
65 	/** indicates the callback that is currently active */
66 	enum nl_cb_type		cb_active;
67 };
68 
69 struct nl_sock
70 {
71 	struct sockaddr_nl	s_local;
72 	struct sockaddr_nl	s_peer;
73 	int			s_fd;
74 	int			s_proto;
75 	unsigned int		s_seq_next;
76 	unsigned int		s_seq_expect;
77 	int			s_flags;
78 	struct nl_cb *		s_cb;
79 	size_t			s_bufsize;
80 };
81 
82 struct nl_cache
83 {
84 	struct nl_list_head	c_items;
85 	int			c_nitems;
86 	int                     c_iarg1;
87 	int                     c_iarg2;
88 	int			c_refcnt;
89 	unsigned int		c_flags;
90 	struct nl_hash_table *	hashtable;
91 	struct nl_cache_ops *   c_ops;
92 };
93 
94 struct nl_cache_assoc
95 {
96 	struct nl_cache *	ca_cache;
97 	change_func_t		ca_change;
98 	void *			ca_change_data;
99 };
100 
101 struct nl_cache_mngr
102 {
103 	int			cm_protocol;
104 	int			cm_flags;
105 	int			cm_nassocs;
106 	struct nl_sock *	cm_sock;
107 	struct nl_sock *	cm_sync_sock;
108 	struct nl_cache_assoc *	cm_assocs;
109 };
110 
111 struct nl_parser_param;
112 
113 #define LOOSE_COMPARISON	1
114 
115 #define NL_OBJ_MARK		1
116 
117 struct nl_data
118 {
119 	size_t			d_size;
120 	void *			d_data;
121 };
122 
123 struct nl_addr
124 {
125 	int			a_family;
126 	unsigned int		a_maxsize;
127 	unsigned int		a_len;
128 	int			a_prefixlen;
129 	int			a_refcnt;
130 	char			a_addr[0];
131 };
132 
133 struct nl_msg
134 {
135 	int			nm_protocol;
136 	int			nm_flags;
137 	struct sockaddr_nl	nm_src;
138 	struct sockaddr_nl	nm_dst;
139 	struct ucred		nm_creds;
140 	struct nlmsghdr *	nm_nlh;
141 	size_t			nm_size;
142 	int			nm_refcnt;
143 };
144 
145 struct rtnl_link_map
146 {
147 	uint64_t lm_mem_start;
148 	uint64_t lm_mem_end;
149 	uint64_t lm_base_addr;
150 	uint16_t lm_irq;
151 	uint8_t  lm_dma;
152 	uint8_t  lm_port;
153 };
154 
155 #define IFQDISCSIZ	32
156 
157 struct rtnl_link
158 {
159 	NLHDR_COMMON
160 
161 	char				l_name[IFNAMSIZ];
162 	uint32_t			l_family;
163 	uint32_t			l_arptype;
164 	uint32_t			l_index;
165 	uint32_t			l_flags;
166 	uint32_t			l_change;
167 	uint32_t 			l_mtu;
168 	uint32_t			l_link;
169 	uint32_t			l_txqlen;
170 	uint32_t			l_weight;
171 	uint32_t			l_master;
172 	struct nl_addr *		l_addr;
173 	struct nl_addr *		l_bcast;
174 	char				l_qdisc[IFQDISCSIZ];
175 	struct rtnl_link_map		l_map;
176 	uint64_t			l_stats[RTNL_LINK_STATS_MAX+1];
177 	uint32_t			l_flag_mask;
178 	uint32_t			l_num_vf;
179 	uint8_t				l_operstate;
180 	uint8_t				l_linkmode;
181 	/* 2 byte hole */
182 	char *				l_info_kind;
183 	struct rtnl_link_info_ops *	l_info_ops;
184 	void *				l_af_data[AF_MAX];
185 	void *				l_info;
186 	char *				l_ifalias;
187 	uint32_t			l_promiscuity;
188 	uint32_t			l_num_tx_queues;
189 	uint32_t			l_num_rx_queues;
190 	uint32_t			l_group;
191 	uint8_t				l_carrier;
192 	/* 3 byte hole */
193 	struct rtnl_link_af_ops *	l_af_ops;
194 	struct nl_data *		l_phys_port_id;
195 	int				l_ns_fd;
196 	pid_t				l_ns_pid;
197 };
198 
199 struct rtnl_ncacheinfo
200 {
201 	uint32_t nci_confirmed;	/**< Time since neighbour validty was last confirmed */
202 	uint32_t nci_used;	/**< Time since neighbour entry was last ued */
203 	uint32_t nci_updated;	/**< Time since last update */
204 	uint32_t nci_refcnt;	/**< Reference counter */
205 };
206 
207 
208 struct rtnl_neigh
209 {
210 	NLHDR_COMMON
211 	uint32_t	n_family;
212 	uint32_t	n_ifindex;
213 	uint16_t	n_state;
214 	uint8_t		n_flags;
215 	uint8_t		n_type;
216 	struct nl_addr *n_lladdr;
217 	struct nl_addr *n_dst;
218 	uint32_t	n_probes;
219 	struct rtnl_ncacheinfo n_cacheinfo;
220 	uint32_t                n_state_mask;
221 	uint32_t                n_flag_mask;
222 	uint32_t		n_master;
223 };
224 
225 
226 struct rtnl_addr_cacheinfo
227 {
228 	/* Preferred lifetime in seconds, ticking from when the message gets constructed */
229 	uint32_t aci_prefered;
230 
231 	/* Valid lifetime in seconds, ticking from when the message gets constructed */
232 	uint32_t aci_valid;
233 
234 	/* Timestamp of creation in 1/100s since boottime, clock_gettime(CLOCK_MONOTONIC) */
235 	uint32_t aci_cstamp;
236 
237 	/* Timestamp of last update in 1/100s since boottime, clock_gettime(CLOCK_MONOTONIC) */
238 	uint32_t aci_tstamp;
239 };
240 
241 struct rtnl_addr
242 {
243 	NLHDR_COMMON
244 
245 	uint8_t		a_family;
246 	uint8_t		a_prefixlen;
247 	uint8_t		a_scope;
248 	uint32_t	a_flags;
249 	uint32_t	a_ifindex;
250 
251 	struct nl_addr *a_peer;
252 	struct nl_addr *a_local;
253 	struct nl_addr *a_bcast;
254 	struct nl_addr *a_anycast;
255 	struct nl_addr *a_multicast;
256 
257 	struct rtnl_addr_cacheinfo a_cacheinfo;
258 
259 	char a_label[IFNAMSIZ];
260 	uint32_t a_flag_mask;
261 	struct rtnl_link *a_link;
262 };
263 
264 struct rtnl_nexthop
265 {
266 	uint8_t			rtnh_flags;
267 	uint8_t			rtnh_flag_mask;
268 	uint8_t			rtnh_weight;
269 	/* 1 byte spare */
270 	uint32_t		rtnh_ifindex;
271 	struct nl_addr *	rtnh_gateway;
272 	uint32_t		ce_mask; /* HACK to support attr macros */
273 	struct nl_list_head	rtnh_list;
274 	uint32_t		rtnh_realms;
275 };
276 
277 struct rtnl_route
278 {
279 	NLHDR_COMMON
280 
281 	uint8_t			rt_family;
282 	uint8_t			rt_dst_len;
283 	uint8_t			rt_src_len;
284 	uint8_t			rt_tos;
285 	uint8_t			rt_protocol;
286 	uint8_t			rt_scope;
287 	uint8_t			rt_type;
288 	uint8_t			rt_nmetrics;
289 	uint32_t		rt_flags;
290 	struct nl_addr *	rt_dst;
291 	struct nl_addr *	rt_src;
292 	uint32_t		rt_table;
293 	uint32_t		rt_iif;
294 	uint32_t		rt_prio;
295 	uint32_t		rt_metrics[RTAX_MAX];
296 	uint32_t		rt_metrics_mask;
297 	uint32_t		rt_nr_nh;
298 	struct nl_addr *	rt_pref_src;
299 	struct nl_list_head	rt_nexthops;
300 	struct rtnl_rtcacheinfo	rt_cacheinfo;
301 	uint32_t		rt_flag_mask;
302 };
303 
304 struct rtnl_rule
305 {
306 	NLHDR_COMMON
307 	uint8_t		r_family;
308 	uint8_t		r_action;
309 	uint8_t		r_dsfield; /* ipv4 only */
310 	uint8_t		r_unused;
311 	uint32_t	r_table;
312 	uint32_t	r_flags;
313 	uint32_t	r_prio;
314 	uint32_t	r_mark;
315 	uint32_t	r_mask;
316 	uint32_t	r_goto;
317 	uint32_t	r_flow; /* ipv4 only */
318 	struct nl_addr *r_src;
319 	struct nl_addr *r_dst;
320 	char		r_iifname[IFNAMSIZ];
321 	char		r_oifname[IFNAMSIZ];
322 };
323 
324 struct rtnl_neightbl_parms
325 {
326 	/**
327 	 * Interface index of the device this parameter set is assigned
328 	 * to or 0 for the default set.
329 	 */
330 	uint32_t		ntp_ifindex;
331 
332 	/**
333 	 * Number of references to this parameter set.
334 	 */
335 	uint32_t		ntp_refcnt;
336 
337 	/**
338 	 * Queue length for pending arp requests, i.e. the number of
339 	 * packets which are accepted from other layers while the
340 	 * neighbour address is still being resolved
341 	 */
342 	uint32_t		ntp_queue_len;
343 
344 	/**
345 	 * Number of requests to send to the user level ARP daemon.
346 	 * Specify 0 to disable.
347 	 */
348 	uint32_t		ntp_app_probes;
349 
350 	/**
351 	 * Maximum number of retries for unicast solicitation.
352 	 */
353 	uint32_t		ntp_ucast_probes;
354 
355 	/**
356 	 * Maximum number of retries for multicast solicitation.
357 	 */
358 	uint32_t		ntp_mcast_probes;
359 
360 	/**
361 	 * Base value in milliseconds to ompute reachable time, see RFC2461.
362 	 */
363 	uint64_t		ntp_base_reachable_time;
364 
365 	/**
366 	 * Actual reachable time (read-only)
367 	 */
368 	uint64_t		ntp_reachable_time;	/* secs */
369 
370 	/**
371 	 * The time in milliseconds between retransmitted Neighbor
372 	 * Solicitation messages.
373 	 */
374 	uint64_t		ntp_retrans_time;
375 
376 	/**
377 	 * Interval in milliseconds to check for stale neighbour
378 	 * entries.
379 	 */
380 	uint64_t		ntp_gc_stale_time;	/* secs */
381 
382 	/**
383 	 * Delay in milliseconds for the first time probe if
384 	 * the neighbour is reachable.
385 	 */
386 	uint64_t		ntp_probe_delay;	/* secs */
387 
388 	/**
389 	 * Maximum delay in milliseconds of an answer to a neighbour
390 	 * solicitation message.
391 	 */
392 	uint64_t		ntp_anycast_delay;
393 
394 	/**
395 	 * Minimum age in milliseconds before a neighbour entry
396 	 * may be replaced.
397 	 */
398 	uint64_t		ntp_locktime;
399 
400 	/**
401 	 * Delay in milliseconds before answering to an ARP request
402 	 * for which a proxy ARP entry exists.
403 	 */
404 	uint64_t		ntp_proxy_delay;
405 
406 	/**
407 	 * Queue length for the delayed proxy arp requests.
408 	 */
409 	uint32_t		ntp_proxy_qlen;
410 
411 	/**
412 	 * Mask of available parameter attributes
413 	 */
414 	uint32_t		ntp_mask;
415 };
416 
417 #define NTBLNAMSIZ	32
418 
419 /**
420  * Neighbour table
421  * @ingroup neightbl
422  */
423 struct rtnl_neightbl
424 {
425 	NLHDR_COMMON
426 
427 	char			nt_name[NTBLNAMSIZ];
428 	uint32_t		nt_family;
429 	uint32_t		nt_gc_thresh1;
430 	uint32_t		nt_gc_thresh2;
431 	uint32_t		nt_gc_thresh3;
432 	uint64_t		nt_gc_interval;
433 	struct ndt_config	nt_config;
434 	struct rtnl_neightbl_parms nt_parms;
435 	struct ndt_stats	nt_stats;
436 };
437 
438 struct rtnl_ratespec
439 {
440 	uint8_t			rs_cell_log;
441 	uint16_t		rs_overhead;
442 	int16_t			rs_cell_align;
443 	uint16_t		rs_mpu;
444 	uint32_t		rs_rate;
445 };
446 
447 struct rtnl_tstats
448 {
449 	struct {
450 		uint64_t            bytes;
451 		uint64_t            packets;
452 	} tcs_basic;
453 
454 	struct {
455 		uint32_t            bps;
456 		uint32_t            pps;
457 	} tcs_rate_est;
458 
459 	struct {
460 		uint32_t            qlen;
461 		uint32_t            backlog;
462 		uint32_t            drops;
463 		uint32_t            requeues;
464 		uint32_t            overlimits;
465 	} tcs_queue;
466 };
467 
468 #define TCKINDSIZ	32
469 
470 #define NL_TC_GENERIC(pre)				\
471 	NLHDR_COMMON					\
472 	uint32_t		pre ##_family;		\
473 	uint32_t		pre ##_ifindex;		\
474 	uint32_t		pre ##_handle;		\
475 	uint32_t		pre ##_parent;		\
476 	uint32_t		pre ##_info;		\
477 	uint32_t		pre ##_mtu;		\
478 	uint32_t		pre ##_mpu;		\
479 	uint32_t		pre ##_overhead;	\
480 	uint32_t		pre ##_linktype;	\
481 	char			pre ##_kind[TCKINDSIZ];	\
482 	struct nl_data *	pre ##_opts;		\
483 	uint64_t		pre ##_stats[RTNL_TC_STATS_MAX+1]; \
484 	struct nl_data *	pre ##_xstats;		\
485 	struct nl_data *	pre ##_subdata;		\
486 	struct rtnl_link *	pre ##_link;		\
487 	struct rtnl_tc_ops *	pre ##_ops;		\
488 	enum rtnl_tc_type	pre ##_type
489 
490 struct rtnl_tc
491 {
492 	NL_TC_GENERIC(tc);
493 };
494 
495 struct rtnl_qdisc
496 {
497 	NL_TC_GENERIC(q);
498 };
499 
500 struct rtnl_class
501 {
502 	NL_TC_GENERIC(c);
503 };
504 
505 struct rtnl_cls
506 {
507 	NL_TC_GENERIC(c);
508 	uint16_t		c_prio;
509 	uint16_t		c_protocol;
510 };
511 
512 struct rtnl_act
513 {
514 	NL_TC_GENERIC(c);
515 	struct rtnl_act *	a_next;
516 };
517 
518 struct rtnl_mirred
519 {
520 	struct tc_mirred m_parm;
521 };
522 
523 struct rtnl_u32
524 {
525 	uint32_t		cu_divisor;
526 	uint32_t		cu_hash;
527 	uint32_t		cu_classid;
528 	uint32_t		cu_link;
529 	struct nl_data *	cu_pcnt;
530 	struct nl_data *	cu_selector;
531 	struct rtnl_act*	cu_act;
532 	struct nl_data *	cu_police;
533 	char			cu_indev[IFNAMSIZ];
534 	int			cu_mask;
535 };
536 
537 struct rtnl_cgroup
538 {
539 	struct rtnl_ematch_tree *cg_ematch;
540 	int			cg_mask;
541 };
542 
543 struct rtnl_fw
544 {
545 	uint32_t		cf_classid;
546 	struct nl_data *	cf_act;
547 	struct nl_data *	cf_police;
548 	char			cf_indev[IFNAMSIZ];
549 	uint32_t		cf_fwmask;
550 	int			cf_mask;
551 };
552 
553 struct rtnl_ematch
554 {
555 	uint16_t		e_id;
556 	uint16_t		e_kind;
557 	uint16_t		e_flags;
558 	uint16_t		e_index;
559 	size_t			e_datalen;
560 
561 	struct nl_list_head	e_childs;
562 	struct nl_list_head	e_list;
563 	struct rtnl_ematch_ops *e_ops;
564 
565 	void *			e_data;
566 };
567 
568 struct rtnl_ematch_tree
569 {
570 	uint16_t		et_progid;
571 	struct nl_list_head	et_list;
572 
573 };
574 
575 struct rtnl_dsmark_qdisc
576 {
577 	uint16_t	qdm_indices;
578 	uint16_t	qdm_default_index;
579 	uint32_t	qdm_set_tc_index;
580 	uint32_t	qdm_mask;
581 };
582 
583 struct rtnl_dsmark_class
584 {
585 	uint8_t		cdm_bmask;
586 	uint8_t		cdm_value;
587 	uint32_t	cdm_mask;
588 };
589 
590 struct rtnl_fifo
591 {
592 	uint32_t	qf_limit;
593 	uint32_t	qf_mask;
594 };
595 
596 struct rtnl_prio
597 {
598 	uint32_t	qp_bands;
599 	uint8_t		qp_priomap[TC_PRIO_MAX+1];
600 	uint32_t	qp_mask;
601 };
602 
603 struct rtnl_tbf
604 {
605 	uint32_t		qt_limit;
606 	struct rtnl_ratespec	qt_rate;
607 	uint32_t		qt_rate_bucket;
608 	uint32_t		qt_rate_txtime;
609 	struct rtnl_ratespec	qt_peakrate;
610 	uint32_t		qt_peakrate_bucket;
611 	uint32_t		qt_peakrate_txtime;
612 	uint32_t		qt_mask;
613 };
614 
615 struct rtnl_sfq
616 {
617 	uint32_t	qs_quantum;
618 	uint32_t	qs_perturb;
619 	uint32_t	qs_limit;
620 	uint32_t	qs_divisor;
621 	uint32_t	qs_flows;
622 	uint32_t	qs_mask;
623 };
624 
625 struct rtnl_netem_corr
626 {
627 	uint32_t	nmc_delay;
628 	uint32_t	nmc_loss;
629 	uint32_t	nmc_duplicate;
630 };
631 
632 struct rtnl_netem_reo
633 {
634 	uint32_t	nmro_probability;
635 	uint32_t	nmro_correlation;
636 };
637 
638 struct rtnl_netem_crpt
639 {
640 	uint32_t	nmcr_probability;
641 	uint32_t	nmcr_correlation;
642 };
643 
644 struct rtnl_netem_dist
645 {
646 	int16_t	*	dist_data;
647 	size_t		dist_size;
648 };
649 
650 struct rtnl_netem
651 {
652 	uint32_t		qnm_latency;
653 	uint32_t		qnm_limit;
654 	uint32_t		qnm_loss;
655 	uint32_t		qnm_gap;
656 	uint32_t		qnm_duplicate;
657 	uint32_t		qnm_jitter;
658 	uint32_t		qnm_mask;
659 	struct rtnl_netem_corr	qnm_corr;
660 	struct rtnl_netem_reo	qnm_ro;
661 	struct rtnl_netem_crpt	qnm_crpt;
662 	struct rtnl_netem_dist  qnm_dist;
663 };
664 
665 struct rtnl_htb_qdisc
666 {
667 	uint32_t		qh_rate2quantum;
668 	uint32_t		qh_defcls;
669 	uint32_t		qh_mask;
670 	uint32_t		qh_direct_pkts;
671 };
672 
673 struct rtnl_htb_class
674 {
675 	uint32_t		ch_prio;
676 	struct rtnl_ratespec	ch_rate;
677 	struct rtnl_ratespec	ch_ceil;
678 	uint32_t		ch_rbuffer;
679 	uint32_t		ch_cbuffer;
680 	uint32_t		ch_quantum;
681 	uint32_t		ch_mask;
682 	uint32_t		ch_level;
683 };
684 
685 struct rtnl_cbq
686 {
687 	struct tc_cbq_lssopt    cbq_lss;
688 	struct tc_ratespec      cbq_rate;
689 	struct tc_cbq_wrropt    cbq_wrr;
690 	struct tc_cbq_ovl       cbq_ovl;
691 	struct tc_cbq_fopt      cbq_fopt;
692 	struct tc_cbq_police    cbq_police;
693 };
694 
695 struct rtnl_red
696 {
697 	uint32_t	qr_limit;
698 	uint32_t	qr_qth_min;
699 	uint32_t	qr_qth_max;
700 	uint8_t		qr_flags;
701 	uint8_t		qr_wlog;
702 	uint8_t		qr_plog;
703 	uint8_t		qr_scell_log;
704 	uint32_t	qr_mask;
705 };
706 
707 struct rtnl_plug
708 {
709 	int             action;
710 	uint32_t        limit;
711 };
712 
713 struct rtnl_fq_codel
714 {
715 	int		fq_limit;
716 	uint32_t	fq_target;
717 	uint32_t	fq_interval;
718 	int		fq_flows;
719 	uint32_t	fq_quantum;
720 	int		fq_ecn;
721 	uint32_t	fq_mask;
722 };
723 
724 struct flnl_request
725 {
726 	NLHDR_COMMON
727 
728 	struct nl_addr *	lr_addr;
729 	uint32_t		lr_fwmark;
730 	uint8_t			lr_tos;
731 	uint8_t			lr_scope;
732 	uint8_t			lr_table;
733 };
734 
735 
736 struct flnl_result
737 {
738 	NLHDR_COMMON
739 
740 	struct flnl_request *	fr_req;
741 	uint8_t			fr_table_id;
742 	uint8_t			fr_prefixlen;
743 	uint8_t			fr_nh_sel;
744 	uint8_t			fr_type;
745 	uint8_t			fr_scope;
746 	uint32_t		fr_error;
747 };
748 
749 #define GENL_OP_HAS_POLICY	1
750 #define GENL_OP_HAS_DOIT	2
751 #define GENL_OP_HAS_DUMPIT	4
752 
753 struct genl_family_op
754 {
755 	uint32_t		o_id;
756 	uint32_t		o_flags;
757 
758 	struct nl_list_head	o_list;
759 };
760 
761 struct genl_family_grp {
762         struct genl_family      *family;        /* private */
763         struct nl_list_head     list;           /* private */
764         char                    name[GENL_NAMSIZ];
765         u_int32_t               id;
766 };
767 
768 struct genl_family
769 {
770 	NLHDR_COMMON
771 
772 	uint16_t		gf_id;
773 	char 			gf_name[GENL_NAMSIZ];
774 	uint32_t		gf_version;
775 	uint32_t		gf_hdrsize;
776 	uint32_t		gf_maxattr;
777 
778 	struct nl_list_head	gf_ops;
779 	struct nl_list_head	gf_mc_grps;
780 };
781 
782 union nfnl_ct_proto
783 {
784 	struct {
785 		uint16_t	src;
786 		uint16_t	dst;
787 	} port;
788 	struct {
789 		uint16_t	id;
790 		uint8_t		type;
791 		uint8_t		code;
792 	} icmp;
793 };
794 
795 struct nfnl_ct_dir {
796 	struct nl_addr *	src;
797 	struct nl_addr *	dst;
798 	union nfnl_ct_proto	proto;
799 	uint64_t		packets;
800 	uint64_t		bytes;
801 };
802 
803 union nfnl_ct_protoinfo {
804 	struct {
805 		uint8_t		state;
806 	} tcp;
807 };
808 
809 struct nfnl_ct {
810 	NLHDR_COMMON
811 
812 	uint8_t			ct_family;
813 	uint8_t			ct_proto;
814 	union nfnl_ct_protoinfo	ct_protoinfo;
815 
816 	uint32_t		ct_status;
817 	uint32_t		ct_status_mask;
818 	uint32_t		ct_timeout;
819 	uint32_t		ct_mark;
820 	uint32_t		ct_use;
821 	uint32_t		ct_id;
822 	uint16_t		ct_zone;
823 
824 	struct nfnl_ct_dir	ct_orig;
825 	struct nfnl_ct_dir	ct_repl;
826 
827 	struct nfnl_ct_timestamp ct_tstamp;
828 };
829 
830 union nfnl_exp_protodata {
831 	struct {
832 		uint16_t	src;
833 		uint16_t	dst;
834 	} port;
835 	struct {
836 		uint16_t	id;
837 		uint8_t		type;
838 		uint8_t		code;
839 	} icmp;
840 };
841 
842 // Allow for different master/expect l4 protocols
843 struct nfnl_exp_proto
844 {
845 	uint8_t						l4protonum;
846 	union nfnl_exp_protodata	l4protodata;
847 };
848 
849 struct nfnl_exp_dir {
850 	struct nl_addr *		src;
851 	struct nl_addr *		dst;
852 	struct nfnl_exp_proto	proto;
853 };
854 
855 struct nfnl_exp {
856 	NLHDR_COMMON
857 
858 	uint8_t			exp_family;
859 	uint32_t		exp_timeout;
860 	uint32_t		exp_id;
861 	uint16_t		exp_zone;
862 	uint32_t		exp_class;
863 	uint32_t		exp_flags;
864 	char *			exp_helper_name;
865 	char *			exp_fn;
866 	uint8_t			exp_nat_dir;
867 
868 	struct nfnl_exp_dir		exp_expect;
869 	struct nfnl_exp_dir		exp_master;
870 	struct nfnl_exp_dir		exp_mask;
871 	struct nfnl_exp_dir		exp_nat;
872 };
873 
874 struct nfnl_log {
875 	NLHDR_COMMON
876 
877 	uint16_t		log_group;
878 	uint8_t			log_copy_mode;
879 	uint32_t		log_copy_range;
880 	uint32_t		log_flush_timeout;
881 	uint32_t		log_alloc_size;
882 	uint32_t		log_queue_threshold;
883 	uint32_t		log_flags;
884 	uint32_t		log_flag_mask;
885 };
886 
887 struct nfnl_log_msg {
888 	NLHDR_COMMON
889 
890 	uint8_t			log_msg_family;
891 	uint8_t			log_msg_hook;
892 	uint16_t		log_msg_hwproto;
893 	uint32_t		log_msg_mark;
894 	struct timeval		log_msg_timestamp;
895 	uint32_t		log_msg_indev;
896 	uint32_t		log_msg_outdev;
897 	uint32_t		log_msg_physindev;
898 	uint32_t		log_msg_physoutdev;
899 	uint8_t			log_msg_hwaddr[8];
900 	int			log_msg_hwaddr_len;
901 	void *			log_msg_payload;
902 	int			log_msg_payload_len;
903 	char *			log_msg_prefix;
904 	uint32_t		log_msg_uid;
905 	uint32_t		log_msg_gid;
906 	uint32_t		log_msg_seq;
907 	uint32_t		log_msg_seq_global;
908 };
909 
910 struct nfnl_queue {
911 	NLHDR_COMMON
912 
913 	uint16_t		queue_group;
914 	uint32_t		queue_maxlen;
915 	uint32_t		queue_copy_range;
916 	uint8_t			queue_copy_mode;
917 };
918 
919 struct nfnl_queue_msg {
920 	NLHDR_COMMON
921 
922 	uint16_t		queue_msg_group;
923 	uint8_t			queue_msg_family;
924 	uint8_t			queue_msg_hook;
925 	uint16_t		queue_msg_hwproto;
926 	uint32_t		queue_msg_packetid;
927 	uint32_t		queue_msg_mark;
928 	struct timeval		queue_msg_timestamp;
929 	uint32_t		queue_msg_indev;
930 	uint32_t		queue_msg_outdev;
931 	uint32_t		queue_msg_physindev;
932 	uint32_t		queue_msg_physoutdev;
933 	uint8_t			queue_msg_hwaddr[8];
934 	int			queue_msg_hwaddr_len;
935 	void *			queue_msg_payload;
936 	int			queue_msg_payload_len;
937 	uint32_t		queue_msg_verdict;
938 };
939 
940 struct ematch_quoted {
941 	char *	data;
942 	size_t	len;
943 	int	index;
944 };
945 
946 struct idiagnl_meminfo {
947 	NLHDR_COMMON
948 
949 	uint32_t idiag_rmem;
950 	uint32_t idiag_wmem;
951 	uint32_t idiag_fmem;
952 	uint32_t idiag_tmem;
953 };
954 
955 struct idiagnl_vegasinfo {
956 	NLHDR_COMMON
957 
958 	uint32_t tcpv_enabled;
959 	uint32_t tcpv_rttcnt;
960 	uint32_t tcpv_rtt;
961 	uint32_t tcpv_minrtt;
962 };
963 
964 struct idiagnl_msg {
965 	NLHDR_COMMON
966 
967 	uint8_t			    idiag_family;
968 	uint8_t			    idiag_state;
969 	uint8_t			    idiag_timer;
970 	uint8_t			    idiag_retrans;
971 	uint16_t		    idiag_sport;
972 	uint16_t		    idiag_dport;
973 	struct nl_addr *	    idiag_src;
974 	struct nl_addr *	    idiag_dst;
975 	uint32_t		    idiag_ifindex;
976 	uint32_t		    idiag_expires;
977 	uint32_t		    idiag_rqueue;
978 	uint32_t		    idiag_wqueue;
979 	uint32_t		    idiag_uid;
980 	uint32_t		    idiag_inode;
981 
982 	uint8_t			    idiag_tos;
983 	uint8_t			    idiag_tclass;
984 	uint8_t			    idiag_shutdown;
985 	char *			    idiag_cong;
986 	struct idiagnl_meminfo *    idiag_meminfo;
987 	struct idiagnl_vegasinfo *  idiag_vegasinfo;
988 	struct tcp_info		    idiag_tcpinfo;
989 	uint32_t		    idiag_skmeminfo[IDIAG_SK_MEMINFO_VARS];
990 };
991 
992 struct idiagnl_req {
993 	NLHDR_COMMON
994 
995 	uint8_t			idiag_family;
996 	uint8_t			idiag_ext;
997 	struct nl_addr *	idiag_src;
998 	struct nl_addr *	idiag_dst;
999 	uint32_t		idiag_ifindex;
1000 	uint32_t		idiag_states;
1001 	uint32_t		idiag_dbs;
1002 };
1003 #endif
1004