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 da4fb21..5937f26 100644 (file)
--- a/dns.h
+++ b/dns.h
@@ -68,6 +68,7 @@ struct dns_question {
 } __attribute__((packed, aligned(2)));
 
 struct interface;
 } __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);
 
 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 4747eef..0f976ad 100644 (file)
--- a/main.c
+++ b/main.c
@@ -37,6 +37,8 @@
 #include "announce.h"
 #include "interface.h"
 
 #include "announce.h"
 #include "interface.h"
 
+int cfg_proto = 0;
+
 static void
 signal_shutdown(int signal)
 {
 static void
 signal_shutdown(int signal)
 {
@@ -50,7 +52,7 @@ main(int argc, char **argv)
 
        uloop_init();
 
 
        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);
                switch (ch) {
                case 't':
                        ttl = atoi(optarg);
@@ -65,6 +67,13 @@ main(int argc, char **argv)
                case 'i':
                        interface_add(optarg);
                        break;
                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;
                }
                default:
                        return -1;
                }