wireguard: Add routes for allowedIPs
[platform/upstream/connman.git] / src / nat.c
index fb55710..681acb2 100755 (executable)
--- a/src/nat.c
+++ b/src/nat.c
@@ -55,8 +55,10 @@ static int enable_ip_forward(bool enable)
                if (read(f, &value, sizeof(value)) < 0)
                        value = 0;
 
-               if (lseek(f, 0, SEEK_SET) < 0)
+               if (lseek(f, 0, SEEK_SET) < 0) {
+                       close(f);
                        return -errno;
+               }
        }
 
        if (enable) {
@@ -201,7 +203,7 @@ static void cleanup_nat(gpointer data)
        g_free(nat);
 }
 
-static struct connman_notifier nat_notifier = {
+static const struct connman_notifier nat_notifier = {
        .name                   = "nat",
        .default_changed        = update_default_interface,
 };