diff options
author | Cedric Berger <cedric@cvs.openbsd.org> | 2004-06-06 16:49:10 +0000 |
---|---|---|
committer | Cedric Berger <cedric@cvs.openbsd.org> | 2004-06-06 16:49:10 +0000 |
commit | 9e25ab1fcd3c8a3b75b6ae3c7ca26a172a86d2e8 (patch) | |
tree | 021044703db486221cd747d714184ece1513b162 /sys/net/route.h | |
parent | ac4791c970556454694a0c9ab754ea95de5b9bc1 (diff) |
extend routing table to be able to match and route packets based on
their *source* IP address in addition to their destination address.
routing table "destination" now contains a "struct sockaddr_rtin"
for IPv4 instead of a "struct sockaddr_in".
the routing socket has been extended in a backward-compatible way.
todo: PMTU enhancements, IPv6. ok deraadt@ mcbride@
Diffstat (limited to 'sys/net/route.h')
-rw-r--r-- | sys/net/route.h | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/sys/net/route.h b/sys/net/route.h index 2b79cd10dbb..fefbda574d2 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -1,4 +1,4 @@ -/* $OpenBSD: route.h,v 1.21 2004/05/04 22:50:18 claudio Exp $ */ +/* $OpenBSD: route.h,v 1.22 2004/06/06 16:49:09 cedric Exp $ */ /* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */ /* @@ -150,6 +150,7 @@ struct ortentry { #define RTF_PROTO2 0x4000 /* protocol specific routing flag */ #define RTF_PROTO1 0x8000 /* protocol specific routing flag */ #define RTF_CLONED 0x10000 /* this is a cloned route */ +#define RTF_SOURCE 0x20000 /* this route has a source selector */ #ifndef _KERNEL /* obsoleted */ @@ -223,6 +224,8 @@ struct rt_msghdr { #define RTA_IFA 0x20 /* interface addr sockaddr present */ #define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */ #define RTA_BRD 0x80 /* for NEWADDR, broadcast or p-p dest addr */ +#define RTA_SRC 0x100 /* source sockaddr present */ +#define RTA_SRCMASK 0x200 /* source netmask present */ /* * Index offsets for sockaddr array for alternate internal encoding. @@ -235,7 +238,9 @@ struct rt_msghdr { #define RTAX_IFA 5 /* interface addr sockaddr present */ #define RTAX_AUTHOR 6 /* sockaddr for author of redirect */ #define RTAX_BRD 7 /* for NEWADDR, broadcast or p-p dest addr */ -#define RTAX_MAX 8 /* size of array to allocate */ +#define RTAX_SRC 8 /* source sockaddr present */ +#define RTAX_SRCMASK 9 /* source netmask present */ +#define RTAX_MAX 10 /* size of array to allocate */ struct rt_addrinfo { int rti_addrs; @@ -295,6 +300,7 @@ struct rttimer_queue { extern struct route_cb route_cb; extern struct rtstat rtstat; extern struct radix_node_head *rt_tables[]; +extern const struct sockaddr_rtin rt_defmask4; struct socket; void route_init(void); @@ -340,5 +346,21 @@ int rtrequest(int, struct sockaddr *, struct sockaddr *, struct sockaddr *, int, struct rtentry **); int rtrequest1(int, struct rt_addrinfo *, struct rtentry **); + +#ifndef SMALL_KERNEL +void sroute_verify_host(struct rt_addrinfo *); +void sroute_clone_route(struct rt_addrinfo *, struct sockaddr *, + struct sockaddr *); +void sroute_compact(struct rt_addrinfo *, int); +void sroute_expand(struct rt_addrinfo *); +struct sockaddr * + sroute_clone_mask4(struct sockaddr *, struct sockaddr *); +#else +#define sroute_compact(ai, int) +#define sroute_expand(ai) +#define sroute_clone_mask4(old, gen) ((gen) != NULL ? (gen) : \ + (struct sockaddr *)&rt_defmask4) +#endif + #endif /* _KERNEL */ #endif /* _NET_ROUTE_H_ */ |