]> git.ipfire.org Git - thirdparty/bird.git/blame - sysdep/linux/krt-sys.h
KRT: Add krt_scope attribute
[thirdparty/bird.git] / sysdep / linux / krt-sys.h
CommitLineData
95616c82
OZ
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
15struct kif_params {
16};
17
c6964c30 18struct kif_state {
95616c82
OZ
19};
20
21
22static inline void kif_sys_init(struct kif_proto *p UNUSED) { }
23static inline int kif_sys_reconfigure(struct kif_proto *p UNUSED, struct kif_config *n UNUSED, struct kif_config *o UNUSED) { return 1; }
24
25static inline void kif_sys_preconfig(struct config *c UNUSED) { }
26static inline void kif_sys_postconfig(struct kif_config *c UNUSED) { }
27static inline void kif_sys_init_config(struct kif_config *c UNUSED) { }
28static inline void kif_sys_copy_config(struct kif_config *d UNUSED, struct kif_config *s UNUSED) { }
29
e237b28a
OZ
30static inline struct ifa * kif_get_primary_ip(struct iface *i) { return NULL; }
31
95616c82
OZ
32
33/* Kernel routes */
34
f9f2e280
OZ
35#define KRT_ALLOW_MERGE_PATHS 1
36
9fdf9d29
OZ
37#define EA_KRT_PREFSRC EA_CODE(EAP_KRT, 0x10)
38#define EA_KRT_REALM EA_CODE(EAP_KRT, 0x11)
6e75d0d2 39#define EA_KRT_SCOPE EA_CODE(EAP_KRT, 0x12)
9fdf9d29
OZ
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
95616c82 90struct krt_params {
9ddbfbdd 91 u32 table_id; /* Kernel table ID we sync with */
4adcb9df 92 u32 metric; /* Kernel metric used for all routes */
95616c82
OZ
93};
94
c6964c30 95struct krt_state {
9ddbfbdd 96 struct krt_proto *hash_next;
95616c82
OZ
97};
98
99
100static inline void krt_sys_init(struct krt_proto *p UNUSED) { }
9ddbfbdd
JMM
101static inline void krt_sys_preconfig(struct config *c UNUSED) { }
102static inline void krt_sys_postconfig(struct krt_config *x UNUSED) { }
95616c82
OZ
103
104
105#endif