From 1e8ef575745583028d78e0292d0424d491a8ed4b Mon Sep 17 00:00:00 2001 From: Vicente Date: Mon, 30 Sep 2013 09:12:24 +0200 Subject: [PATCH] dnsmasq: daemon->icmp6fd is always valid when doing DHCPv6 now. add/contribut. add macscript. create table if not exists. --- release/src/router/dnsmasq/VERSION | 2 +- .../src/router/dnsmasq/contrib/mactable/macscript | 36 ++++++++++++++++++++++ release/src/router/dnsmasq/src/option.c | 4 +++ 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100755 release/src/router/dnsmasq/contrib/mactable/macscript diff --git a/release/src/router/dnsmasq/VERSION b/release/src/router/dnsmasq/VERSION index 2a0986e06f..e57cccabde 100644 --- a/release/src/router/dnsmasq/VERSION +++ b/release/src/router/dnsmasq/VERSION @@ -1 +1 @@ -2.67test16/09/25/2013 +2.67test16. 09/29/2013 diff --git a/release/src/router/dnsmasq/contrib/mactable/macscript b/release/src/router/dnsmasq/contrib/mactable/macscript new file mode 100755 index 0000000000..44a447727f --- /dev/null +++ b/release/src/router/dnsmasq/contrib/mactable/macscript @@ -0,0 +1,36 @@ +#!/bin/bash + +STATUS_FILE="/tmp/dnsmasq-ip-mac.status" + +# Script for dnsmasq lease-change hook. +# Maintains the above file with a IP address/MAC address pairs, +# one lease per line. Works with IPv4 and IPv6 leases, file is +# atomically updated, so no races for users of the data. + +action="$1" +mac="$2" # IPv4 +ip="$3" + +# ensure it always exists. + +if [ ! -f "$STATUS_FILE" ]; then + touch "$STATUS_FILE" +fi + +if [ -n "$DNSMASQ_IAID" ]; then + mac="$DNSMASQ_MAC" # IPv6 +fi + +# worry about an add or old action when the MAC address is not known: +# leave any old one in place in that case. + +if [ "$action" = "add" -o "$action" = "old" -o "$action" = "del" ]; then + if [ -n "$mac" -o "$action" = "del" ]; then + sed "/^${ip//./\.} / d" "$STATUS_FILE" > "$STATUS_FILE".new + + if [ "$action" = "add" -o "$action" = "old" ]; then + echo "$ip $mac" >> "$STATUS_FILE".new + fi + mv "$STATUS_FILE".new "$STATUS_FILE" # atomic update. + fi +fi diff --git a/release/src/router/dnsmasq/src/option.c b/release/src/router/dnsmasq/src/option.c index 70d43fe955..7534c4f5e8 100644 --- a/release/src/router/dnsmasq/src/option.c +++ b/release/src/router/dnsmasq/src/option.c @@ -1587,6 +1587,8 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma break; } + +#ifdef HAVE_AUTH case LOPT_AUTHSERV: /* --auth-server */ if (!(comma = split(arg))) ret_err(gen_err); @@ -1709,6 +1711,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma } break; +#endif case 's': /* --domain */ case LOPT_SYNTH: /* --synth-domain */ @@ -2420,6 +2423,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma #ifdef HAVE_DHCP6 else if (inet_pton(AF_INET6, a[0], &new->start6)) { + new->flags |= CONTEXT_V6; new->prefix = 64; /* default */ new->end6 = new->start6; new->next = daemon->dhcp6; -- 2.11.4.GIT