[IPv4]: FIB configuration using struct fib_config
Introduces struct fib_config replacing the ugly struct kern_rta prone to ordering issues. Avoids creating faked netlink messages for auto generated routes or requests via ioctl. A new interface net/nexthop.h is added to help navigate through nexthop configuration arrays. A new struct nl_info will be used to carry the necessary netlink information to be used for notifications later on. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
ab32ea5d8a
commit
4e902c5741
@@ -20,25 +20,32 @@
|
||||
#include <linux/seq_file.h>
|
||||
#include <net/fib_rules.h>
|
||||
|
||||
/* WARNING: The ordering of these elements must match ordering
|
||||
* of RTA_* rtnetlink attribute numbers.
|
||||
*/
|
||||
struct kern_rta {
|
||||
void *rta_dst;
|
||||
void *rta_src;
|
||||
int *rta_iif;
|
||||
int *rta_oif;
|
||||
void *rta_gw;
|
||||
u32 *rta_priority;
|
||||
void *rta_prefsrc;
|
||||
struct rtattr *rta_mx;
|
||||
struct rtattr *rta_mp;
|
||||
unsigned char *rta_protoinfo;
|
||||
u32 *rta_flow;
|
||||
struct rta_cacheinfo *rta_ci;
|
||||
struct rta_session *rta_sess;
|
||||
u32 *rta_mp_alg;
|
||||
};
|
||||
struct fib_config {
|
||||
u8 fc_family;
|
||||
u8 fc_dst_len;
|
||||
u8 fc_src_len;
|
||||
u8 fc_tos;
|
||||
u8 fc_protocol;
|
||||
u8 fc_scope;
|
||||
u8 fc_type;
|
||||
/* 1 byte unused */
|
||||
u32 fc_table;
|
||||
u32 fc_dst;
|
||||
u32 fc_src;
|
||||
u32 fc_gw;
|
||||
int fc_oif;
|
||||
u32 fc_flags;
|
||||
u32 fc_priority;
|
||||
u32 fc_prefsrc;
|
||||
struct nlattr *fc_mx;
|
||||
struct rtnexthop *fc_mp;
|
||||
int fc_mx_len;
|
||||
int fc_mp_len;
|
||||
u32 fc_flow;
|
||||
u32 fc_mp_alg;
|
||||
u32 fc_nlflags;
|
||||
struct nl_info fc_nlinfo;
|
||||
};
|
||||
|
||||
struct fib_info;
|
||||
|
||||
@@ -154,12 +161,8 @@ struct fib_table {
|
||||
u32 tb_id;
|
||||
unsigned tb_stamp;
|
||||
int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res);
|
||||
int (*tb_insert)(struct fib_table *table, struct rtmsg *r,
|
||||
struct kern_rta *rta, struct nlmsghdr *n,
|
||||
struct netlink_skb_parms *req);
|
||||
int (*tb_delete)(struct fib_table *table, struct rtmsg *r,
|
||||
struct kern_rta *rta, struct nlmsghdr *n,
|
||||
struct netlink_skb_parms *req);
|
||||
int (*tb_insert)(struct fib_table *, struct fib_config *);
|
||||
int (*tb_delete)(struct fib_table *, struct fib_config *);
|
||||
int (*tb_dump)(struct fib_table *table, struct sk_buff *skb,
|
||||
struct netlink_callback *cb);
|
||||
int (*tb_flush)(struct fib_table *table);
|
||||
@@ -228,8 +231,6 @@ struct rtentry;
|
||||
extern int ip_fib_check_default(u32 gw, struct net_device *dev);
|
||||
extern int fib_sync_down(u32 local, struct net_device *dev, int force);
|
||||
extern int fib_sync_up(struct net_device *dev);
|
||||
extern int fib_convert_rtentry(int cmd, struct nlmsghdr *nl, struct rtmsg *rtm,
|
||||
struct kern_rta *rta, struct rtentry *r);
|
||||
extern u32 __fib_res_prefsrc(struct fib_result *res);
|
||||
|
||||
/* Exported by fib_hash.c */
|
||||
|
Reference in New Issue
Block a user