add -4 and -6 options
authorJohn Crispin <blogic@openwrt.org>
Fri, 29 Aug 2014 19:24:35 +0000 (21:24 +0200)
committerJohn Crispin <blogic@openwrt.org>
Fri, 29 Aug 2014 19:24:35 +0000 (21:24 +0200)
Signed-off-by: John Crispin <blogic@openwrt.org>
dns.h
main.c

diff --git a/dns.h b/dns.h
index da4fb2149e876673ff7419814df3e54ae3e23b64..5937f26c278ae6cff96fc8664acacfb1637fe92a 100644 (file)
--- a/dns.h
+++ b/dns.h
@@ -68,6 +68,7 @@ struct dns_question {
 } __attribute__((packed, aligned(2)));
 
 struct interface;
+extern int cfg_proto;
 
 void dns_send_question(struct interface *iface, const char *question, int type);
 void dns_init_answer(void);
diff --git a/main.c b/main.c
index 4747eef5e60eda57126d8ffd3528e5bb84d1c562..0f976add9912512e0cc7e12e61bf2306ae5e4b98 100644 (file)
--- a/main.c
+++ b/main.c
@@ -37,6 +37,8 @@
 #include "announce.h"
 #include "interface.h"
 
+int cfg_proto = 0;
+
 static void
 signal_shutdown(int signal)
 {
@@ -50,7 +52,7 @@ main(int argc, char **argv)
 
        uloop_init();
 
-       while ((ch = getopt(argc, argv, "t:i:d")) != -1) {
+       while ((ch = getopt(argc, argv, "t:i:d46")) != -1) {
                switch (ch) {
                case 't':
                        ttl = atoi(optarg);
@@ -65,6 +67,13 @@ main(int argc, char **argv)
                case 'i':
                        interface_add(optarg);
                        break;
+               case '4':
+       fprintf(stderr, "%s:%s[%d]\n", __FILE__, __func__, __LINE__);
+                       cfg_proto = 4;
+                       break;
+               case '6':
+                       cfg_proto = 6;
+                       break;
                default:
                        return -1;
                }