4 /* WARNING: The ordering of these elements must match ordering
5 * of RTA_* rtnetlink attribute numbers.
15 struct rtattr
*rta_mx
;
16 struct rtattr
*rta_mp
;
17 unsigned char *rta_protoinfo
;
19 struct rta_cacheinfo
*rta_ci
;
20 struct rta_session
*rta_sess
;
25 struct dn_fib_info
*fi
;
26 unsigned char prefixlen
;
33 struct net_device
*nh_dev
;
35 unsigned char nh_scope
;
43 struct dn_fib_info
*fib_next
;
44 struct dn_fib_info
*fib_prev
;
52 __u32 fib_metrics
[RTAX_MAX
];
55 struct dn_fib_nh fib_nh
[0];
56 #define dn_fib_dev fib_nh[0].nh_dev
60 #define DN_FIB_RES_RESET(res) ((res).nh_sel = 0)
61 #define DN_FIB_RES_NH(res) ((res).fi->fib_nh[(res).nh_sel])
63 #define DN_FIB_RES_PREFSRC(res) ((res).fi->fib_prefsrc ? : __dn_fib_res_prefsrc(&res))
64 #define DN_FIB_RES_GW(res) (DN_FIB_RES_NH(res).nh_gw)
65 #define DN_FIB_RES_DEV(res) (DN_FIB_RES_NH(res).nh_dev)
66 #define DN_FIB_RES_OIF(res) (DN_FIB_RES_NH(res).nh_oif)
81 struct dn_fib_node
*fn_next
;
82 struct dn_fib_info
*fn_info
;
83 #define DN_FIB_INFO(f) ((f)->fn_info)
92 struct hlist_node hlist
;
95 int (*insert
)(struct dn_fib_table
*t
, struct rtmsg
*r
,
96 struct dn_kern_rta
*rta
, struct nlmsghdr
*n
,
97 struct netlink_skb_parms
*req
);
98 int (*delete)(struct dn_fib_table
*t
, struct rtmsg
*r
,
99 struct dn_kern_rta
*rta
, struct nlmsghdr
*n
,
100 struct netlink_skb_parms
*req
);
101 int (*lookup
)(struct dn_fib_table
*t
, const struct flowi
*fl
,
102 struct dn_fib_res
*res
);
103 int (*flush
)(struct dn_fib_table
*t
);
104 int (*dump
)(struct dn_fib_table
*t
, struct sk_buff
*skb
, struct netlink_callback
*cb
);
106 unsigned char data
[0];
109 #ifdef CONFIG_DECNET_ROUTER
113 extern void dn_fib_init(void);
114 extern void dn_fib_cleanup(void);
116 extern int dn_fib_ioctl(struct socket
*sock
, unsigned int cmd
,
118 extern struct dn_fib_info
*dn_fib_create_info(const struct rtmsg
*r
,
119 struct dn_kern_rta
*rta
,
120 const struct nlmsghdr
*nlh
, int *errp
);
121 extern int dn_fib_semantic_match(int type
, struct dn_fib_info
*fi
,
122 const struct flowi
*fl
,
123 struct dn_fib_res
*res
);
124 extern void dn_fib_release_info(struct dn_fib_info
*fi
);
125 extern __le16
dn_fib_get_attr16(struct rtattr
*attr
, int attrlen
, int type
);
126 extern void dn_fib_flush(void);
127 extern void dn_fib_select_multipath(const struct flowi
*fl
,
128 struct dn_fib_res
*res
);
133 extern struct dn_fib_table
*dn_fib_get_table(u32 n
, int creat
);
134 extern struct dn_fib_table
*dn_fib_empty_table(void);
135 extern void dn_fib_table_init(void);
136 extern void dn_fib_table_cleanup(void);
141 extern void dn_fib_rules_init(void);
142 extern void dn_fib_rules_cleanup(void);
143 extern unsigned dnet_addr_type(__le16 addr
);
144 extern int dn_fib_lookup(struct flowi
*fl
, struct dn_fib_res
*res
);
146 extern int dn_fib_dump(struct sk_buff
*skb
, struct netlink_callback
*cb
);
148 extern void dn_fib_free_info(struct dn_fib_info
*fi
);
150 static inline void dn_fib_info_put(struct dn_fib_info
*fi
)
152 if (atomic_dec_and_test(&fi
->fib_clntref
))
153 dn_fib_free_info(fi
);
156 static inline void dn_fib_res_put(struct dn_fib_res
*res
)
159 dn_fib_info_put(res
->fi
);
161 fib_rule_put(res
->r
);
166 #define dn_fib_init() do { } while(0)
167 #define dn_fib_cleanup() do { } while(0)
169 #define dn_fib_lookup(fl, res) (-ESRCH)
170 #define dn_fib_info_put(fi) do { } while(0)
171 #define dn_fib_select_multipath(fl, res) do { } while(0)
172 #define dn_fib_rules_policy(saddr,res,flags) (0)
173 #define dn_fib_res_put(res) do { } while(0)
175 #endif /* CONFIG_DECNET_ROUTER */
177 static inline __le16
dnet_make_mask(int n
)
180 return cpu_to_le16(~((1 << (16 - n
)) - 1));
181 return cpu_to_le16(0);
184 #endif /* _NET_DN_FIB_H */