summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gre.c4
1 files 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: