2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
6 * Definitions for the IP router.
8 * Version: @(#)route.h 1.0.4 05/27/93
10 * Authors: Ross Biro, <bir7@leland.Stanford.Edu>
11 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
13 * Alan Cox : Reformatted. Added ip_rt_local()
14 * Alan Cox : Support for TCP parameters.
15 * Alexey Kuznetsov: Major changes for new routing code.
16 * Mike McLagan : Routing by source
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License
20 * as published by the Free Software Foundation; either version
21 * 2 of the License, or (at your option) any later version.
26 #include <linux/config.h>
28 #include <linux/in_route.h>
29 #include <linux/rtnetlink.h>
30 #include <linux/route.h>
33 #warning This file is not supposed to be used outside of kernel.
36 #define RT_HASH_DIVISOR 256
38 #define RTO_ONLINK 0x01
39 #define RTO_TPROXY 0x80000000
49 #ifdef CONFIG_IP_ROUTE_FWMARK
61 struct rtable
*rt_next
;
67 __u32 rt_dst
; /* Path destination */
68 __u32 rt_src
; /* Path source */
71 /* Info on neighbour */
74 /* Cache lookup keys */
77 /* Miscellaneous cached information */
78 __u32 rt_spec_dst
; /* RFC1122 specific destination */
80 #ifdef CONFIG_IP_ROUTE_NAT
94 extern struct ip_rt_acct ip_rt_acct
[256];
95 extern rwlock_t ip_rt_acct_lock
;
97 extern void ip_rt_init(void);
98 extern void ip_rt_redirect(u32 old_gw
, u32 dst
, u32 new_gw
,
99 u32 src
, u8 tos
, struct net_device
*dev
);
100 extern void ip_rt_advice(struct rtable
**rp
, int advice
);
101 extern void rt_cache_flush(int how
);
102 extern int ip_route_output(struct rtable
**, u32 dst
, u32 src
, u32 tos
, int oif
);
103 extern int ip_route_input(struct sk_buff
*, u32 dst
, u32 src
, u8 tos
, struct net_device
*devin
);
104 extern unsigned short ip_rt_frag_needed(struct iphdr
*iph
, unsigned short new_mtu
);
105 extern void ip_rt_update_pmtu(struct dst_entry
*dst
, unsigned mtu
);
106 extern void ip_rt_send_redirect(struct sk_buff
*skb
);
108 extern unsigned inet_addr_type(u32 addr
);
109 extern void ip_rt_multicast_event(struct in_device
*);
110 extern int ip_rt_ioctl(unsigned int cmd
, void *arg
);
111 extern void ip_rt_get_source(u8
*src
, struct rtable
*rt
);
112 extern int ip_rt_dump(struct sk_buff
*skb
, struct netlink_callback
*cb
);
115 extern __inline__
void ip_rt_put(struct rtable
* rt
)
118 dst_release(&rt
->u
.dst
);
121 extern __u8 ip_tos2prio
[16];
123 extern __inline__
char rt_tos2priority(u8 tos
)
125 return ip_tos2prio
[IPTOS_TOS(tos
)>>1];
128 extern __inline__
int ip_route_connect(struct rtable
**rp
, u32 dst
, u32 src
, u32 tos
, int oif
)
131 err
= ip_route_output(rp
, dst
, src
, tos
, oif
);
132 if (err
|| (dst
&& src
))
138 return ip_route_output(rp
, dst
, src
, tos
, oif
);
141 #endif /* _ROUTE_H */