4 #include <linux/config.h>
6 #ifdef CONFIG_DECNET_ROUTER
8 #include <linux/rtnetlink.h>
19 struct rtattr *rta_mx;
20 struct rtattr *rta_mp;
21 unsigned char *rta_protoinfo;
22 unsigned char *rta_flow;
23 struct rta_cacheinfo *rta_ci;
36 struct dn_fib_rule *r;
37 struct dn_fib_info *fi;
38 unsigned char prefixlen;
45 struct net_device *nh_dev;
47 unsigned char nh_scope;
55 struct dn_fib_info *fib_next;
56 struct dn_fib_info *fib_prev;
62 dn_address fib_prefsrc;
66 struct dn_fib_nh fib_nh[0];
67 #define fib_dev fib_nh[0].nh_dev
71 #define DN_FIB_RES_NH(res) ((res).fi->fib_nh[(res).nh_sel])
72 #define DN_FIB_RES_RESET(res) ((res).nh_sel = 0)
73 #define DN_FIB_RES_GW(res) (DN_FIB_RES_NH(res).nh_gw)
74 #define DN_FIB_RES_DEV(res) (DN_FIB_RES_NH(res).nh_dev)
75 #define DN_FIB_RES_OIF(res) (DN_FIB_RES_NH(res).nh_oif)
90 struct dn_fib_node *fn_next;
91 struct dn_fib_info *fn_info;
92 #define DN_FIB_INFO(f) ((f)->fn_info)
100 struct dn_fib_table {
103 int (*insert)(struct dn_fib_table *t, struct rtmsg *r,
104 struct dn_kern_rta *rta, struct nlmsghdr *n,
105 struct netlink_skb_parms *req);
106 int (*delete)(struct dn_fib_table *t, struct rtmsg *r,
107 struct dn_kern_rta *rta, struct nlmsghdr *n,
108 struct netlink_skb_parms *req);
109 int (*lookup)(struct dn_fib_table *t, const struct dn_fib_key *key,
110 struct dn_fib_res *res);
111 int (*flush)(struct dn_fib_table *t);
112 #ifdef CONFIG_PROC_FS
113 int (*get_info)(struct dn_fib_table *table, char *buf,
114 int first, int count);
115 #endif /* CONFIG_PROC_FS */
116 int (*dump)(struct dn_fib_table *t, struct sk_buff *skb, struct netlink_callback *cb);
118 unsigned char data[0];
125 extern void dn_fib_init(void);
126 extern void dn_fib_cleanup(void);
128 extern int dn_fib_rt_message(struct sk_buff *skb);
129 extern int dn_fib_ioctl(struct socket *sock, unsigned int cmd,
131 extern struct dn_fib_info *dn_fib_create_info(const struct rtmsg *r,
132 struct dn_kern_rta *rta,
133 const struct nlmsghdr *nlh, int *errp);
134 extern int dn_fib_semantic_match(int type, struct dn_fib_info *fi,
135 const struct dn_fib_key *key, struct dn_fib_res *res);
136 extern void dn_fib_release_info(struct dn_fib_info *fi);
137 extern u16 dn_fib_get_attr16(struct rtattr *attr, int attrlen, int type);
138 extern void dn_fib_flush(void);
139 extern void dn_fib_select_multipath(const struct dn_fib_key *key,
140 struct dn_fib_res *res);
141 extern int dn_fib_sync_down(dn_address local, struct net_device *dev,
143 extern int dn_fib_sync_up(struct net_device *dev);
148 extern struct dn_fib_table *dn_fib_get_table(int n, int creat);
149 extern struct dn_fib_table *dn_fib_empty_table(void);
150 extern void dn_fib_table_init(void);
151 extern void dn_fib_table_cleanup(void);
156 extern void dn_fib_rules_init(void);
157 extern void dn_fib_rules_cleanup(void);
158 extern void dn_fib_rule_put(struct dn_fib_rule *);
159 extern int dn_fib_lookup(struct dn_fib_key *key, struct dn_fib_res *res);
162 * rtnetlink interface
164 extern int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
165 extern int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
166 extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb);
168 extern int dn_fib_rtm_delrule(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
169 extern int dn_fib_rtm_newrule(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
170 extern int dn_fib_dump_rules(struct sk_buff *skb, struct netlink_callback *cb);
172 #define DN_NUM_TABLES 255
173 #define DN_MIN_TABLE 1
174 #define DN_DEFAULT_TABLE 1
175 #define DN_L1_TABLE 1
176 #define DN_L2_TABLE 2
178 extern void dn_fib_free_info(struct dn_fib_info *fi);
180 static __inline__ void dn_fib_info_put(struct dn_fib_info *fi)
182 if (atomic_dec_and_test(&fi->fib_clntref))
183 dn_fib_free_info(fi);
186 static __inline__ void dn_fib_res_put(struct dn_fib_res *res)
189 dn_fib_info_put(res->fi);
191 dn_fib_rule_put(res->r);
194 static __inline__ u16 dnet_make_mask(int n)
197 return htons(~((1<<(16-n))-1));
201 #endif /* CONFIG_DECNET_ROUTER */
203 #endif /* _NET_DN_FIB_H */