diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2020-10-16 21:30:07 +0200 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2020-10-16 23:36:25 +0200 |
commit | fb967676d21ffeb79cf1c118119b883721589d0b (patch) | |
tree | 2d06fd46a58aa1c6e90e7a77e7e7bbc23f276bb9 | |
parent | 39a59eda8f39a7b29a3b7357d84594c320794219 (diff) |
improve mgre
-rw-r--r-- | gre.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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: |