ASR_BASE
Change-Id: Icf3719cc0afe3eeb3edc7fa80a2eb5199ca9dda1
diff --git a/external/subpack/net/wifidog/patches/020-Modify-get-ip-from-iface-method.patch b/external/subpack/net/wifidog/patches/020-Modify-get-ip-from-iface-method.patch
new file mode 100644
index 0000000..9a13ba1
--- /dev/null
+++ b/external/subpack/net/wifidog/patches/020-Modify-get-ip-from-iface-method.patch
@@ -0,0 +1,26 @@
+From 37b2dda9b1d62eb91028f6d590beddd36f7b79c8 Mon Sep 17 00:00:00 2001
+From: Nathan Samson <nathan@nathansamson.be>
+Date: Mon, 1 Feb 2016 21:37:22 +0100
+Subject: [PATCH] Modify get ip from iface method.
+
+This used to use a RAW socket, while now it used a DGRAM socket.
+Previously it failed with operation not permitted, while this version
+seems to work reliably.
+
+--- a/src/util.c
++++ b/src/util.c
+@@ -174,11 +174,13 @@ get_iface_ip(const char *ifname)
+ u_int32_t ip;
+
+ /* Create a socket */
+- if ((sockd = socket(AF_INET, SOCK_RAW, htons(0x8086))) < 0) {
++ if ((sockd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ debug(LOG_ERR, "socket(): %s", strerror(errno));
+ return NULL;
+ }
+
++ /* I want to get an IPv4 IP address */
++ if_data.ifr_addr.sa_family = AF_INET;
+ /* Get IP of internal interface */
+ strncpy(if_data.ifr_name, ifname, 15);
+ if_data.ifr_name[15] = '\0';