diff options
| author | Nakidai <nakidai@disroot.org> | 2025-11-23 12:57:52 +0300 |
|---|---|---|
| committer | Nakidai <nakidai@disroot.org> | 2025-11-23 12:57:52 +0300 |
| commit | 8231f3bef51e0d30eec41aab78631c29b00db491 (patch) | |
| tree | 955962cf353ead52f05b636fd806624dbbf7dbe4 /fatvpnd.c | |
| parent | b1ec6ae205a00142971672a505585f3da87d4a9f (diff) | |
| download | fatvpn-master.tar.gz fatvpn-master.zip | |
Diffstat (limited to 'fatvpnd.c')
| -rw-r--r-- | fatvpnd.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fatvpnd.c b/fatvpnd.c index f3f891b..b2fa145 100644 --- a/fatvpnd.c +++ b/fatvpnd.c @@ -38,20 +38,24 @@ int main(int argc, char *argv[]){ memset(&c, 0, sizeof(c)); c.ss_family = AF_INET; (*(struct sockaddr_in*)&c).sin_port = htons((u16)atoi(argv[argc-1])); +#ifdef ENABLE_IPV6 if (argc == 4){ res = inet_pton(AF_INET6, argv[2], ((struct sockaddr_in6*)&c)->sin6_addr.s6_addr); if (res != 1){ +#endif res = inet_pton(AF_INET, argv[2], &psz); if (res != 1){ fprintf(stderr, "wrong addr: %s\n",argv[2]); exit(1); } memcpy(&((struct sockaddr_in*)&c)->sin_addr.s_addr, &psz, 4); +#ifdef ENABLE_IPV6 } else { c.ss_family = AF_INET6; } } +#endif if (strlen(argv[1]) + 1 > IFNAMSIZ) fputs("tap name is too long\n", stderr), exit(1); @@ -197,6 +201,7 @@ inf_loop: ((struct sockaddr_in*)&c)->sin_addr.s_addr == ((struct sockaddr_in*)&peer[i].a)->sin_addr.s_addr) break; break; +#ifdef ENABLE_IPV6 case AF_INET6: for (i=0; i < ccnt; i++) if (((struct sockaddr_in6*)&c)->sin6_port == @@ -204,6 +209,7 @@ inf_loop: 0 == memcmp(((struct sockaddr_in6*)&c)->sin6_addr.s6_addr, ((struct sockaddr_in6*)&peer[i].a)->sin6_addr.s6_addr, 16)) break; break; +#endif } if (i == ccnt){ |