diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-05-20 21:39:37 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-05-20 21:39:37 +0200 |
commit | 425ca0afc4ba1cc12cfec0ac058fb47c7b8b7ccf (patch) | |
tree | aa46b5cef54ff9e9c194a5dec53e3e3ac4854f9f | |
parent | 2c991fbaee9b6e9122e235ca5f4c9ce8c9aff12a (diff) | |
download | vyatta-cfg-system-425ca0afc4ba1cc12cfec0ac058fb47c7b8b7ccf.tar.gz vyatta-cfg-system-425ca0afc4ba1cc12cfec0ac058fb47c7b8b7ccf.zip |
drop legacy local_ip binary - no longer used
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | src/local_ip.c | 66 |
2 files changed, 0 insertions, 68 deletions
diff --git a/Makefile.am b/Makefile.am index 96aa658d..8942838a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -47,13 +47,11 @@ sbin_SCRIPTS += scripts/vyatta-dhcpv6-client.pl sbin_SCRIPTS += scripts/vyos-persistpath sbin_PROGRAMS = src/valid_address -sbin_PROGRAMS += src/local_ip share_perl5_DATA = share_perl5_DATA += scripts/XorpConfigParser.pm src_valid_address = src/valid_address.c -src_local_ip = src/local_ip.c sysconf_DATA += sysconf/LICENSE sysconf_DATA += sysconf/motd.tail diff --git a/src/local_ip.c b/src/local_ip.c deleted file mode 100644 index f238acfe..00000000 --- a/src/local_ip.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Test if an IP address is assigned to the local system - * - * This uses the fact Linux will not allow binding to an address that - * is not on the system. It is much faster than scanning all the - * interface addresses. - */ - -#include <stdio.h> -#include <string.h> -#include <errno.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> - -int main(int argc, char **argv) -{ - int af, s; - - if (argc != 2) { - fprintf(stderr, "Usage: %s x.x.x.x\n", argv[0]); - return -1; - } - - af = strchr(argv[1], ':') ? AF_INET6 : AF_INET; - s = socket(af, SOCK_STREAM, 0); - if (s < 0) { - perror("socket"); - return -1; - } - - if (af == AF_INET) { - struct sockaddr_in sin = { - .sin_family = AF_INET, - }; - - if (inet_pton(af, argv[1], &sin.sin_addr) <= 0) { - fprintf(stderr, "%s: invalid address\n", argv[1]); - return -1; - } - - if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { - if (errno == EADDRNOTAVAIL) - return 1; - perror("bind"); - return -1; - } - } else { - struct sockaddr_in6 sin6 = { - .sin6_family = AF_INET6, - }; - - if (inet_pton(af, argv[1], &sin6.sin6_addr) <= 0) { - fprintf(stderr, "%s: invalid address\n", argv[1]); - return -1; - } - - if (bind(s, (struct sockaddr *)&sin6, sizeof(sin6)) < 0) { - if (errno == EADDRNOTAVAIL) - return 1; - perror("bind"); - return -1; - } - } - return 0; -} |