diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2011-04-04 15:50:19 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2011-04-04 15:50:19 +0000 |
commit | eb2ec7d52c7e9765dd4a2f2f970e23c20567fa71 (patch) | |
tree | f4ade5cecec9119076000f63f789863a52716d1f /sys/net/if_gre.c | |
parent | 60250e40ea425e42fc81b4899f94475fd2882a31 (diff) |
Don't do crazy address manipulations when looking up the remote end
of the gre(4) tunnel. Instead just us a RT_NOCLONING route lookup
and be done with it. Makes gre(4) work between systems in the same
LAN. This diff was enough long on tech@ and nobody complained.
Diffstat (limited to 'sys/net/if_gre.c')
-rw-r--r-- | sys/net/if_gre.c | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c index 2ce6b600160..f6e08e248db 100644 --- a/sys/net/if_gre.c +++ b/sys/net/if_gre.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_gre.c,v 1.52 2010/09/23 11:34:50 blambert Exp $ */ +/* $OpenBSD: if_gre.c,v 1.53 2011/04/04 15:50:18 claudio Exp $ */ /* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */ /* @@ -675,29 +675,13 @@ void gre_compute_route(struct gre_softc *sc) { struct route *ro; - u_int32_t a, b, c; ro = &sc->route; bzero(ro, sizeof(struct route)); - ((struct sockaddr_in *) &ro->ro_dst)->sin_addr = sc->g_dst; ro->ro_dst.sa_family = AF_INET; ro->ro_dst.sa_len = sizeof(ro->ro_dst); - - /* - * toggle last bit, so our interface is not found, but a less - * specific route. I'd rather like to specify a shorter mask, - * but this is not possible. Should work though. XXX - * there is a simpler way ... - */ - if ((sc->sc_if.if_flags & IFF_LINK1) == 0) { - a = ntohl(sc->g_dst.s_addr); - b = a & 0x01; - c = a & 0xfffffffe; - b = b ^ 0x01; - a = b | c; - ((struct sockaddr_in *) &ro->ro_dst)->sin_addr.s_addr = htonl(a); - } + ((struct sockaddr_in *) &ro->ro_dst)->sin_addr = sc->g_dst; ro->ro_rt = rtalloc1(&ro->ro_dst, RT_REPORT | RT_NOCLONING, sc->g_rtableid); @@ -714,13 +698,6 @@ gre_compute_route(struct gre_softc *sc) ro->ro_rt = NULL; return; } - - /* - * now change it back - else ip_output will just drop - * the route and search one to this interface ... - */ - if ((sc->sc_if.if_flags & IFF_LINK1) == 0) - ((struct sockaddr_in *) &ro->ro_dst)->sin_addr = sc->g_dst; } /* |