1 /*
2  *	BIRD -- Linux Kernel Netlink Route Syncer
3  *
4  *	(c) 1998--2000 Martin Mares <mj@ucw.cz>
5  *
6  *	Can be freely distributed and used under the terms of the GNU GPL.
7  */
8 
9 #ifndef _BIRD_KRT_SYS_H_
10 #define _BIRD_KRT_SYS_H_
11 
12 
13 /* Kernel interfaces */
14 
15 struct kif_params {
16 };
17 
18 struct kif_state {
19 };
20 
21 
kif_sys_init(struct kif_proto * p UNUSED)22 static inline void kif_sys_init(struct kif_proto *p UNUSED) { }
kif_sys_reconfigure(struct kif_proto * p UNUSED,struct kif_config * n UNUSED,struct kif_config * o UNUSED)23 static inline int kif_sys_reconfigure(struct kif_proto *p UNUSED, struct kif_config *n UNUSED, struct kif_config *o UNUSED) { return 1; }
24 
kif_sys_preconfig(struct config * c UNUSED)25 static inline void kif_sys_preconfig(struct config *c UNUSED) { }
kif_sys_postconfig(struct kif_config * c UNUSED)26 static inline void kif_sys_postconfig(struct kif_config *c UNUSED) { }
kif_sys_init_config(struct kif_config * c UNUSED)27 static inline void kif_sys_init_config(struct kif_config *c UNUSED) { }
kif_sys_copy_config(struct kif_config * d UNUSED,struct kif_config * s UNUSED)28 static inline void kif_sys_copy_config(struct kif_config *d UNUSED, struct kif_config *s UNUSED) { }
29 
kif_get_primary_ip(struct iface * i UNUSED)30 static inline struct ifa * kif_get_primary_ip(struct iface *i UNUSED) { return NULL; }
31 
32 
33 /* Kernel routes */
34 
35 #define KRT_ALLOW_MERGE_PATHS	1
36 
37 #define EA_KRT_PREFSRC		EA_CODE(EAP_KRT, 0x10)
38 #define EA_KRT_REALM		EA_CODE(EAP_KRT, 0x11)
39 #define EA_KRT_SCOPE		EA_CODE(EAP_KRT, 0x12)
40 
41 
42 #define KRT_METRICS_MAX		0x10	/* RTAX_QUICKACK+1 */
43 #define KRT_METRICS_OFFSET	0x20	/* Offset of EA_KRT_* vs RTAX_* */
44 
45 #define KRT_FEATURES_MAX	4
46 
47 /*
48  * Following attributes are parts of RTA_METRICS kernel route attribute, their
49  * ids must be consistent with their RTAX_* constants (+ KRT_METRICS_OFFSET)
50  */
51 #define EA_KRT_METRICS		EA_CODE(EAP_KRT, 0x20)	/* Dummy one */
52 #define EA_KRT_LOCK		EA_CODE(EAP_KRT, 0x21)
53 #define EA_KRT_MTU		EA_CODE(EAP_KRT, 0x22)
54 #define EA_KRT_WINDOW		EA_CODE(EAP_KRT, 0x23)
55 #define EA_KRT_RTT		EA_CODE(EAP_KRT, 0x24)
56 #define EA_KRT_RTTVAR		EA_CODE(EAP_KRT, 0x25)
57 #define EA_KRT_SSTRESH		EA_CODE(EAP_KRT, 0x26)
58 #define EA_KRT_CWND		EA_CODE(EAP_KRT, 0x27)
59 #define EA_KRT_ADVMSS		EA_CODE(EAP_KRT, 0x28)
60 #define EA_KRT_REORDERING 	EA_CODE(EAP_KRT, 0x29)
61 #define EA_KRT_HOPLIMIT		EA_CODE(EAP_KRT, 0x2a)
62 #define EA_KRT_INITCWND		EA_CODE(EAP_KRT, 0x2b)
63 #define EA_KRT_FEATURES		EA_CODE(EAP_KRT, 0x2c)
64 #define EA_KRT_RTO_MIN		EA_CODE(EAP_KRT, 0x2d)
65 #define EA_KRT_INITRWND		EA_CODE(EAP_KRT, 0x2e)
66 #define EA_KRT_QUICKACK		EA_CODE(EAP_KRT, 0x2f)
67 
68 /* Bits of EA_KRT_LOCK, also based on RTAX_* constants */
69 #define EA_KRT_LOCK_MTU		EA_KRT_LOCK | EA_BIT(0x2)
70 #define EA_KRT_LOCK_WINDOW	EA_KRT_LOCK | EA_BIT(0x3)
71 #define EA_KRT_LOCK_RTT		EA_KRT_LOCK | EA_BIT(0x4)
72 #define EA_KRT_LOCK_RTTVAR	EA_KRT_LOCK | EA_BIT(0x5)
73 #define EA_KRT_LOCK_SSTHRESH	EA_KRT_LOCK | EA_BIT(0x6)
74 #define EA_KRT_LOCK_CWND	EA_KRT_LOCK | EA_BIT(0x7)
75 #define EA_KRT_LOCK_ADVMSS	EA_KRT_LOCK | EA_BIT(0x8)
76 #define EA_KRT_LOCK_REORDERING 	EA_KRT_LOCK | EA_BIT(0x9)
77 #define EA_KRT_LOCK_HOPLIMIT	EA_KRT_LOCK | EA_BIT(0xa)
78 // define EA_KRT_LOCK_INITCWND	EA_KRT_LOCK | EA_BIT(0xb)
79 // define EA_KRT_LOCK_FEATURES	EA_KRT_LOCK | EA_BIT(0xc)
80 #define EA_KRT_LOCK_RTO_MIN	EA_KRT_LOCK | EA_BIT(0xd)
81 // define EA_KRT_LOCK_INITRWND	EA_KRT_LOCK | EA_BIT(0xe)
82 
83 /* Bits of EA_KRT_FEATURES, based on RTAX_FEATURE_* constants */
84 #define EA_KRT_FEATURE_ECN	EA_KRT_FEATURES | EA_BIT(0x0)
85 // define EA_KRT_FEATURE_SACK	EA_KRT_FEATURES | EA_BIT(0x1)
86 // define EA_KRT_FEATURE_TSTAMP	EA_KRT_FEATURES | EA_BIT(0x2)
87 #define EA_KRT_FEATURE_ALLFRAG	EA_KRT_FEATURES | EA_BIT(0x3)
88 
89 
90 struct krt_params {
91   u32 table_id;				/* Kernel table ID we sync with */
92   u32 metric;				/* Kernel metric used for all routes */
93 };
94 
95 struct krt_state {
96   struct krt_proto *hash_next;
97 };
98 
99 
krt_sys_init(struct krt_proto * p UNUSED)100 static inline void krt_sys_init(struct krt_proto *p UNUSED) { }
krt_sys_preconfig(struct config * c UNUSED)101 static inline void krt_sys_preconfig(struct config *c UNUSED) { }
krt_sys_postconfig(struct krt_config * x UNUSED)102 static inline void krt_sys_postconfig(struct krt_config *x UNUSED) { }
103 
104 
105 #endif
106