diff options
| author | David S. Miller <davem@nuts.ninka.net> | 2002-10-19 09:50:10 -0700 |
|---|---|---|
| committer | David S. Miller <davem@nuts.ninka.net> | 2002-10-19 09:50:10 -0700 |
| commit | 97be95af016ec31d022b85644636974768bbebeb (patch) | |
| tree | 802a3c857562c0ad2456dd0c93d318f5f19c2f32 /include/net | |
| parent | 01770cd0a701503228e32191b22e7dccc3c56697 (diff) | |
[IPV4]: Provide full proto/ports in flowi route lookups.
Diffstat (limited to 'include/net')
| -rw-r--r-- | include/net/route.h | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/include/net/route.h b/include/net/route.h index 621b0c44b250..0a65f6a6b884 100644 --- a/include/net/route.h +++ b/include/net/route.h @@ -139,12 +139,16 @@ static inline char rt_tos2priority(u8 tos) return ip_tos2prio[IPTOS_TOS(tos)>>1]; } -static inline int ip_route_connect(struct rtable **rp, u32 dst, u32 src, u32 tos, int oif) +static inline int ip_route_connect(struct rtable **rp, u32 dst, u32 src, u32 tos, int oif, u8 protocol, u16 sport, u16 dport) { - struct flowi fl = { .nl_u = { .ip4_u = { .daddr = dst, + struct flowi fl = { .oif = oif, + .nl_u = { .ip4_u = { .daddr = dst, .saddr = src, .tos = tos } }, - .oif = oif }; + .proto = protocol, + .uli_u = { .ports = + { .sport = sport, + .dport = dport } } }; int err; err = ip_route_output_key(rp, &fl); @@ -157,6 +161,21 @@ static inline int ip_route_connect(struct rtable **rp, u32 dst, u32 src, u32 tos return ip_route_output_key(rp, &fl); } +static inline int ip_route_newports(struct rtable **rp, u16 sport, u16 dport) +{ + if (sport != (*rp)->fl.uli_u.ports.sport || + dport != (*rp)->fl.uli_u.ports.dport) { + struct flowi fl; + + memcpy(&fl, &(*rp)->fl, sizeof(fl)); + fl.uli_u.ports.sport = sport; + fl.uli_u.ports.dport = dport; + *rp = NULL; + return ip_route_output_key(rp, &fl); + } + return 0; +} + extern void rt_bind_peer(struct rtable *rt, int create); static inline struct inet_peer *rt_get_peer(struct rtable *rt) |
