From fb967676d21ffeb79cf1c118119b883721589d0b Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Fri, 16 Oct 2020 21:30:07 +0200 Subject: improve mgre --- gre.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gre.c b/gre.c index 68f155c..3a44d8c 100644 --- a/gre.c +++ b/gre.c @@ -282,7 +282,7 @@ static int gre_ipv4(uint8_t **bufp, int *np) } // check source IPv4 address const struct sockaddr_in *remote_in = (const struct sockaddr_in *)&remote; - if (*(uint32_t *)(buf + 12) != remote_in->sin_addr.s_addr) + if (!remote_any && *(uint32_t *)(buf + 12) != remote_in->sin_addr.s_addr) { printf("Wrong IPv4 source\n"); return -1; @@ -328,7 +328,7 @@ static int gre_any(const uint8_t *buf, int n) return -1; } uint16_t protocol = ntohs(*(uint16_t *)(buf + 2)); - if (type == IFF_TUN) + if (type == IFF_TUN || remote_any) { switch (protocol) { case ETHERTYPE_IP: -- cgit v1.2.3