Re: [Dnsmasq-discuss] Query: DNSMASQ_LEASE_EXPIRES

2016-12-21 Thread Nehal J Wani
On Thu, Sep 22, 2016 at 3:21 PM, Nehal J Wani <nehaljw.k...@gmail.com> wrote:
> Hi!
>
> According to the man page of dnsmasq, DNSMASQ_LEASE_EXPIRES stores the
> time of lease expiry and DNSMASQ_TIME_REMAINING stores the number of
> seconds until expiry and these are passed to the script specified to
> the option --dhcp-script.
>
> Consider the scenario when the configuration has specified 'infinite'
> as the value of  for a particular dhcp-range. In this
> case, the value of DNSMASQ_LEASE_EXPIRES is always 0 and
> DNSMASQ_TIME_REMAINING is not even present. Is this an expected
> behaviour?
>
> Another query: the value of lease-time is stored in an unsigned int
> while parsing the options and it is different in struct script_data.
> Is there a specific reason behind choosing different datatypes?
>

Ping! :-)


-- 
Nehal J Wani

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


[Dnsmasq-discuss] Query: DNSMASQ_LEASE_EXPIRES

2016-09-22 Thread Nehal J Wani
Hi!

According to the man page of dnsmasq, DNSMASQ_LEASE_EXPIRES stores the
time of lease expiry and DNSMASQ_TIME_REMAINING stores the number of
seconds until expiry and these are passed to the script specified to
the option --dhcp-script.

Consider the scenario when the configuration has specified 'infinite'
as the value of  for a particular dhcp-range. In this
case, the value of DNSMASQ_LEASE_EXPIRES is always 0 and
DNSMASQ_TIME_REMAINING is not even present. Is this an expected
behaviour?

Another query: the value of lease-time is stored in an unsigned int
while parsing the options and it is different in struct script_data.
Is there a specific reason behind choosing different datatypes?

Cheers!
Nehal J Wani

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Query regarding --leasefile-ro

2014-07-01 Thread Nehal J Wani
 That looks sensible. I guess from these questions that you're thinking
 about storing the lease database just in the custom format, and using
 --leasefile-ro

Right now, libvirt stores all leases for each interface in separate
files. That is, one lease database per dnsmasq instance, it does so,
on the basis of the environment variable DNSMASQ_INTERFACE (I know
that it is not set in case of del events everytime). The trouble is,
when it gets the argument 'init', how will my helper program know
which database it has to read and print to stdout? Suppose if we have
only one lease database for all dnsmasq instances, how will the leases
helper program distinguish between different interfaces (that is, for
which interface should I print info, if I get 'init' as argument)? How
does it happen by default, when none of --dhcp-script and
--leasefile-ro are provided?


Thanking You,
Nehal J Wani

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


[Dnsmasq-discuss] Query regarding --leasefile-ro

2014-06-30 Thread Nehal J Wani
Hi!

The man page of dnsmasq (under the section -9, --leasefile-ro), states:
When called like this the script should write the saved state of the
lease database, in dnsmasq leasefile format, to stdout and exit with
zero exit code.

Q1. What is the purpose of printing to stdout? I guess it is for
dnsmasq to know the information of previous leases, but I am not sure.
Q2. What all information do I need to print in 'dnsmasq leasefile
format' ? What is the exact format? Is there an example for this (like
the example file macscript)?
Q3. Apart from the leases, dnsmasq also prints some extra information
like duid 00:01:00:01:1b:40:8d:94:00:25:64:8b:e4:2c in the lease
file. Is this also mandatory to print to stdout in case I use
leasefile-ro ?

Thanking You,
Nehal J Wani

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


[Dnsmasq-discuss] old event to dhcp-script on lease expiry

2014-06-27 Thread Nehal J Wani
Hi!

I am trying to understand whether an 'old' event is generated or not
when a lease expires. To experiment this, I used
Dnsmasq version 2.72test3-5-gcdb755c
I launch dnsmasq like this:
sudo /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default6.conf
--dhcp-script=/tmp/script.sh

Contents of script:
#!/bin/bash echo $@  /tmp/out
env  /tmp/out
echo   /tmp/out

Contents of default6.conf:
strict-order pid-file=/var/run/libvirt/network/default6.pid
except-interface=lo bind-dynamic interface=virbr3
dhcp-range=192.168.150.128,192.168.150.254,2m
dhcp-no-override
dhcp-range=2001:db8:ca2:2:1::10,2001:db8:ca2:2:1::ff,2m
dhcp-leasefile=/var/lib/libvirt/dnsmasq/default6.leases
dhcp-lease-max=367
dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default6.hostsfile
addn-hosts=/var/lib/libvirt/dnsmasq/default6.addnhosts enable-ra

When I run 'service network restart' inside my guest machine, I see
that the script is exec'ed with 'old' event. Now, I see that the lease
file /var/lib/libvirt/dnsmasq/default6.leases keeps getting updated
after every 2 minutes, since the lease expires, but the script
/tmp/script.sh doesn't get invoked when the lease gets renewed. Is
this expected? I don't see any 'old' event for the renewed lease.

Regards,
Nehal J Wani

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] old event to dhcp-script on lease expiry

2014-06-27 Thread Nehal J Wani
 An old event is not generated when a lease is _renewed_ (ie when the
 only thing that changes is the expiration time) unless the option
 leasefile-ro is set. Note that setting leasefile-ro has a bunch of other
 effects too.

 When a lease _expires_ (ie the end time of the lease is reached without
 it being renewed) then a a del event is generated.

So, if I understand correctly, there is no way to maintain the leases
file database *and* have my own script catch all events? Why does
dnsmasq put such restrictions? It would be cool to have both
concurrently.

Another question, not very much related to dnsmasq, is that when a
machine receives a lease for a particular period, when should it query
the DHCP again for a new lease? Is it bound to do so, by some RFC? Or
is a matter of choice by the developer?

-- 
Nehal J Wani

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] old event to dhcp-script on lease expiry

2014-06-27 Thread Nehal J Wani
On Sat, Jun 28, 2014 at 12:58 AM, Simon Kelley si...@thekelleys.org.uk wrote:
 On 27/06/14 19:40, Nehal J Wani wrote:
 An old event is not generated when a lease is _renewed_ (ie when the
 only thing that changes is the expiration time) unless the option
 leasefile-ro is set. Note that setting leasefile-ro has a bunch of other
 effects too.

 When a lease _expires_ (ie the end time of the lease is reached without
 it being renewed) then a a del event is generated.

 So, if I understand correctly, there is no way to maintain the leases
 file database *and* have my own script catch all events? Why does
 dnsmasq put such restrictions?

 That's correct. The reason for the behaviour is mainly historical. At
 first, the script received just the events needed to log the existance
 of leases.  Later, the ability to use the script to maintain the lease
 database was added, and for that, changes to the expiration time had to
 be noted. THe old behaviour (when leasefile-ro is not set) stayed for
 backwards compatibility.

 It would be cool to have both
 concurrently.

 As a pragmatic approach, the patch to get the behaviour you want is very
 small.


Recently, an API for querying leases info guest machines was pushed in
libvirt and will most likely be available in 1.2.6. Since this library
is used by many people around the world, and we have our custom lease
file helper, which maintains a separate database for leases in JSON
format, if we just enable leasefile-ro, then we will loose the lease
file generated by dnsmasq, and we don't want that. Hence, sending a
patch is fine by me, but will you be willing to have this option
available in dnsmasq?


 Another question, not very much related to dnsmasq, is that when a
 machine receives a lease for a particular period, when should it query
 the DHCP again for a new lease? Is it bound to do so, by some RFC? Or
 is a matter of choice by the developer?

 The server can include the information in the lease. There are three
 options which it can include. The length of the lease is mandatory, and
 there are two options called T1 and T2. T1 is the time after which the
 client should renew the lease by doing unicast to the server which gave
 it the lease. T2 is the time after which the client should try
 broadcasting if it fails to renew the lease, to give the other half of a
 failover pair a chance to reply. T1 defaults to half of the lease time,
 and T2 to 7/8ths of the leasetime. In practise it's very rare to use
 other values for these. Dnsmasq always send T1 as half lease time and T2
 as 7/8th the lease time. It doesn't allow them to be configured
 differently. The RFC the details this is RFC 2131.


Thanks for all this info.
Query1: If the lease time is say, 10 minutes, then T1 will be 5
minutes. Then according to the RFC, the machine should ask for a
renewal of the lease from the DHCP server using the unicast method? In
this case, no event will be generated?  But you said that, The old
behaviour (when leasefile-ro is not set) stayed for backwards
compatibility.
Query2: What does dnsmasq do if the machine sends no request for
renewal at all? Will it just delete the lease?

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


[Dnsmasq-discuss] Reg: --dhcp-script option

2013-12-16 Thread Nehal J Wani
Suppose I am using the script for dnsmasq lease-change hook
([dnsmasq.git] / contrib / mactable / macscript) and 3 leases have
been handed out for a particular network. Now, if I shutdown the
network and start dnsmasq again after these 3 leases have expired, the
leases file has zero entries, but the /tmp/dnsmasq-ip-mac.status
file will have those old entries. How will I clean them up? Will I
have to manually check the timestamps and remove those entries or
dnsmasq provides something that I am missing?

-- 
Nehal J Wani

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Reg: --dhcp-script option

2013-12-16 Thread Nehal J Wani
Is the environment variable DNSMASQ_INTERFACE set when del action is
called? If not, why?

On 12/17/13, Simon Kelley si...@thekelleys.org.uk wrote:
 On 16/12/13 19:06, Nehal J Wani wrote:
 Suppose I am using the script for dnsmasq lease-change hook
 ([dnsmasq.git] / contrib / mactable / macscript) and 3 leases have
 been handed out for a particular network. Now, if I shutdown the
 network and start dnsmasq again after these 3 leases have expired, the
 leases file has zero entries, but the /tmp/dnsmasq-ip-mac.status
 file will have those old entries. How will I clean them up? Will I
 have to manually check the timestamps and remove those entries or
 dnsmasq provides something that I am missing?


 You'll see del events for the leases, either when they actually
 expire, or (if dnsmasq isn't running then) when dnsmasq is started again.


 Cheers,

 Simon.


 ___
 Dnsmasq-discuss mailing list
 Dnsmasq-discuss@lists.thekelleys.org.uk
 http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss



-- 
Nehal J Wani

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Reg: --dhcp-script option

2013-12-16 Thread Nehal J Wani
On 12/17/13, Simon Kelley si...@thekelleys.org.uk wrote:
 On 16/12/13 21:26, Nehal J Wani wrote:
 Is the environment variable DNSMASQ_INTERFACE set when del action is
 called? If not, why?

 It _may_ be, if the interface associated with the lease is known. That
 information is not stored in the lease file, so restarting dnsmasq will
 lose the knowledge of the interface and DNSMASQ_INTERFACE will not be
 set, unless there's an intervening event that provides the information.

 So

 restart dnsmasq
 renew DHCP lease
 DHCP lease expires
 del event sent

 will set DNSMASQ_INTERFACE

 but

 stop dnsmasq
 wait whilst lease expires
 start dnsmasq
 dnsmasq notices that lease has expired and sends del event

 won't.

 This is also true of many of the other data supplied, eg
 DNSMASQ_VENDOR_CLASS, DNSMASQ_SUPPLIED_HOSTNAME, DNSMASQ_CIRCUIT_ID

 Cheers,


 Simon.





 On 12/17/13, Simon Kelley si...@thekelleys.org.uk wrote:
 On 16/12/13 19:06, Nehal J Wani wrote:
 Suppose I am using the script for dnsmasq lease-change hook
 ([dnsmasq.git] / contrib / mactable / macscript) and 3 leases have
 been handed out for a particular network. Now, if I shutdown the
 network and start dnsmasq again after these 3 leases have expired, the
 leases file has zero entries, but the /tmp/dnsmasq-ip-mac.status
 file will have those old entries. How will I clean them up? Will I
 have to manually check the timestamps and remove those entries or
 dnsmasq provides something that I am missing?


 You'll see del events for the leases, either when they actually
 expire, or (if dnsmasq isn't running then) when dnsmasq is started
 again.


 Cheers,

 Simon.


 ___
 Dnsmasq-discuss mailing list
 Dnsmasq-discuss@lists.thekelleys.org.uk
 http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss






Actually, while developing the leases API for libvirt, I have to keep
separate custom-leases file for each network. (One active network is
mapped to one interface only) So, I thought, why not use the env
DNSMASQ_INTERFACE to differentiate? I have attached the source code of
script. The problem arises during:
restart dnsmasq
renew DHCP lease
DHCP lease expires
del event sent
Now, since the interface is not known, I'll have to compare IP address
in each file! Is there no way of knowing which file it should
correspond to?

I want to keep leases in different files to ease my task, so that once
a network is completely destroyed and undefined, its leases can also
be deleted easily (by just using unlink() on the desired file).

-- 
Nehal J Wani
/*
 * leasehelper.c:
 *
 * Copyright (C) 2013-2014 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.  If not, see
 * http://www.gnu.org/licenses/.
 *
 * Author: Nehal J Wani nehaljw.k...@gmail.com
 *
 */

#include config.h

#include stdio.h
#include stdlib.h

#include virutil.h
#include virfile.h
#include virbuffer.h
#include virstring.h
#include virerror.h
#include viralloc.h
#include configmake.h

#define VIR_FROM_THIS VIR_FROM_NETWORK

/**
 * VIR_NETWORK_DHCP_LEASE_FIELDS:
 *
 * Macro providing the maximum number of fields in an entry in
 * the leases file
 */
#define VIR_NETWORK_DHCP_LEASE_FIELDS 6
/**
 * VIR_NETWORK_DHCP_LEASE_FILE_SIZE_MAX:
 *
 * Macro providing the upper limit on the size of leases file
 */
#define VIR_NETWORK_DHCP_LEASE_FILE_SIZE_MAX 2097152

/*
 * Use this when passing possibly-NULL strings to printf-a-likes.
 */
# define NULL_STR(s) ((s) ? (s) : *)

int
main(int argc, char **argv) {

/* Doesn't hurt to check */
if (argc  4)
return -1;

const char *action = argv[1];
const char *interface = NULL_STR(getenv(DNSMASQ_INTERFACE));
const char *expirytime = NULL_STR(getenv(DNSMASQ_LEASE_EXPIRES));
const char *mac = argv[2];
const char *ip = argv[3];
const char *iaid = NULL_STR(getenv(DNSMASQ_IAID));
const char *hostname = NULL_STR(getenv(DNSMASQ_SUPPLIED_HOSTNAME));
const char *clientid = NULL_STR(getenv(DNSMASQ_CLIENT_ID));
const char *leases_str = NULL;
char *lease_file = NULL;
char *lease_entries = NULL;
char *lease_entry = NULL;
char **lease_fields = NULL;
bool delete = false;
bool add = false;
int rv = -1;
int lease_file_len = 0;
FILE *fp = NULL;
virBuffer buf_new_lease = VIR_BUFFER_INITIALIZER;
virBuffer buf_all_leases = VIR_BUFFER_INITIALIZER;

if (virAsprintf

Re: [Dnsmasq-discuss] Reg: Info related to leases file

2013-10-22 Thread Nehal J Wani
 if [ -n $DNSMASQ_IAID ]; then
   mac=$DNSMASQ_MAC   # IPv6

The existence of the environment variable DNSMASQ_MAC is not mentioned
in the man page formed from the recent pull of dnsmaq code. It would
be helpful if someone could add it :)


-- 
Nehal J Wani

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Reg: Info related to leases file

2013-10-22 Thread Nehal J Wani
On Tue, Oct 22, 2013 at 11:44 PM, Simon Kelley si...@thekelleys.org.uk wrote:
 On 22/10/13 19:09, Nehal J Wani wrote:

 if [ -n $DNSMASQ_IAID ]; then
mac=$DNSMASQ_MAC   # IPv6


 The existence of the environment variable DNSMASQ_MAC is not mentioned
 in the man page formed from the recent pull of dnsmaq code. It would
 be helpful if someone could add it :)



 The man page was updated in the checkin that added the feature.

 http://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=blobdiff;f=man/dnsmasq.8;h=e313d54fa86abf77ecbc3253d976bcae9b15997e;hp=05733b8da95cfc36c7c557005d850f7ef4aa607a;hb=89500e31f199e9ae1eadc86213b911ff44d30d6f;hpb=c8f2dd8b5363b9026ae3de6ce84b5b64df657892

 Cheers,

 Simon.


I am using Fedora 18 and after a successful make install, man
dnsmasq reads from /usr/share/man/man8/dnsmasq.8.gz (the old version)
whereas /usr/local/share/man/man8/dnsmasq.8 contains the latest
version. Seems like removal of the old gziped file was required.

-- 
Nehal J Wani

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Reg: Info related to leases file

2013-10-03 Thread Nehal J Wani
 Yes. I just added contrib/mactable/macscript to the git repo, which is your
 previous script slightly less elegantly modified by me for this
 circumstance. I also put back the make new file then atomically rename
 behaviour since that means anything using this file doesn't risk a race
 condition leading to a half-written file.


I gave a try to the --dhcp-script option of dnsmasq. Following are the findings:

Script used: (a little modified version of
http://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=blob_plain;f=contrib/mactable/macscript;hb=HEAD):

#!/bin/bash

STATUS_FILE=/var/lib/libvirt/
dnsmasq/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

expirytime=$DNSMASQ_LEASE_EXPIRES
hostname=$DNSMASQ_SUPPLIED_HOSTNAME
clientid=$DNSMASQ_CLIENT_ID

# ensure it always exists.

if [ ! -f $STATUS_FILE ]; then
  touch $STATUS_FILE
fi

if [  -n $DNSMASQ_IAID ]; then
mac=$DNSMASQ_MAC   # IPv6
clientid=$2
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 $expirytime $mac $ip $hostname $clientid  $STATUS_FILE.new
fi
mv  $STATUS_FILE.new $STATUS_FILE # atomic update.
  fi
fi



Changes made to libvirt code:

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 8787bdb..7f9a74f 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -1058,6 +1058,7 @@
networkBuildDhcpDaemonCommandLine(virNetworkObjPtr network,

 cmd = virCommandNew(dnsmasqCapsGetBinaryPath(caps));
 virCommandAddArgFormat(cmd, --conf-file=%s, configfile);
+virCommandAddArgFormat(cmd, --dhcp-script=%s,
/var/lib/libvirt/dnsmasq/macscript.sh);
 *cmdout = cmd;
 ret = 0;
 cleanup:


In dnsmasq version 2.65 (latest on f18 repos), useful variables that were set:
In the case of ipv4:
$1=add $2=52:54:00:95:41:5d $3=192.168.100.128
DNSMASQ_INTERFACE=virbr0
DNSMASQ_TAGS=virbr0
DNSMASQ_TIME_REMAINING=3600
DNSMASQ_LEASE_EXPIRES=1380745674

In the case of ipv6:
$1=add $2=00:01:00:01:19:df:2e:19:52:54:00:24:13:15 $3=2001:db8:ca2:2:1::45
DNSMASQ_INTERFACE=virbr3
DNSMASQ_TAGS=dhcpv6 virbr3
DNSMASQ_SERVER_DUID=00:01:00:01:19:df:29:7e:f0:4d:a2:8c:14:51
DNSMASQ_IAID=2364181
DNSMASQ_TIME_REMAINING=3600
DNSMASQ_LEASE_EXPIRES=1380745131


In the latest dnsmasq version 2.67rc2-3-g889d8a1 (built after cloning
from git://thekelleys.org.uk/dnsmasq.git), useful variables that were
set:
In the case of ipv4:
add 52:54:00:1a:a1:55 192.168.100.204
DNSMASQ_INTERFACE=virbr0
DNSMASQ_LEASE_EXPIRES=1380749702
DNSMASQ_TAGS=virbr0
DNSMASQ_TIME_REMAINING=3600


In the case of ipv6:
add 00:01:00:01:19:df:3a:8e:52:54:00:7d:49:25 2001:db8:ca2:2:1::f5
DNSMASQ_IAID=8210725
DNSMASQ_INTERFACE=virbr3
DNSMASQ_LEASE_EXPIRES=1380748320
DNSMASQ_MAC=52:54:00:7d:49:25
DNSMASQ_SERVER_DUID=
DNSMASQ_TAGS=dhcpv6 virbr3
DNSMASQ_TIME_REMAINING=3600


So, in case of latest dnsmasq code, output in dnsmasq-ip-mac.status:
1380747917 52:54:00:82:5e:09 2001:db8:ca2:2:1::79
1380747943 52:54:00:61:bd:d8 2001:db8:ca2:2:1::88
1380748110 52:54:00:15:1e:05 192.168.100.180
1380748320 52:54:00:7d:49:25 2001:db8:ca2:2:1::f5
00:01:00:01:19:df:3a:8e:52:54:00:7d:49:25
1380749702 52:54:00:1a:a1:55 192.168.100.204
1380749877 52:54:00:73:0a:27 192.168.100.190
1380749879 52:54:00:b7:87:3e 2001:db8:ca2:2:1::3e
00:01:00:01:19:df:40:a6:52:54:00:b7:87:3e
1380749880 52:54:00:bc:55:df 2001:db8:ca2:2:1::8f
00:01:00:01:19:df:40:a6:52:54:00:bc:55:df
1380749880 52:54:00:b7:87:3e 2001:db8:ca2:2:1::3e
00:01:00:01:19:df:40:a6:52:54:00:b7:87:3e


Apologies for the long message.

Queries:
(i) Why is DNSMASQ_SERVER_DUID blank in case of ipv6 (dnsmasq
2.67rc2-3-g889d8a1) ? Is it an issue with libvirt code or dnsmasq?
(ii) When will be dnsmasq version 2.67rc2-3-g889d8a1 be out as tarball
and when will it be available in the fedora repositories? (I don't
know who maintains the package buildings, but a tentative date would
be fine)

-- 
Nehal J Wani

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Reg: Info related to leases file

2013-09-24 Thread Nehal J Wani


 Could you give an example of the DHCPv6 leases file with IPv4 as well
 as IPv6 addresses?


Never Mind. I generated it myself.

1380008809 52:54:00:c3:73:d7 192.168.122.62 * *
1380007610 52:54:00:2a:47:ee 192.168.122.68 * *
duid 00:01:00:01:19:d3:ec:62:f0:4d:a2:8c:14:51
1380008810 12809175 2001:db8:ca2:2:1::67 *
00:01:00:01:19:d3:f1:da:52:54:00:c3:73:d7
1380007610 2770926 2001:db8:ca2:2:1::3e *
00:01:00:01:19:d3:ed:2a:52:54:00:2a:47:ee


Thanks for the info.




 --
 Nehal J Wani
 UG3, BTech CS+MS(CL)
 IIIT-Hyderabad
 http://commandlinewani.blogspot.com



-- 
Nehal J Wani

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Reg: Info related to leases file

2013-09-24 Thread Nehal J Wani
On Tue, Sep 24, 2013 at 1:15 AM, Simon Kelley si...@thekelleys.org.uk wrote:
 On 23/09/13 19:12, Nehal J Wani wrote:

 If I am not wrong, there are 5 fields in a dnsmasq/network-name.leases
 file:

 (i) Expiry time
 (ii) MAC Address
 (iii) IP Address
 (iv) Hostname
 (v) Client ID

 Q1: Is the above order fixed?
 Q2: Which values from above can be NULL? (I know that leases contains
 '*' for fields whose values are not known, but is it safe to assume
 that it will be '*' for any value that is unknown?)


 A1: Yes.

 A2: There will always be an expiry time and an IP address. The hostname and
 the client-id can be missing, in which case the fields will contain *.

 The Mac address may have a hardware type (rfc1060) appended like so:

 02-01:02:03:04:05:06

 If the hardware type is 01 (ethernet), then it's omitted

 For IEEE1394 clients, the hardware type is 24, and the length of the MAC
 address is zero, so this appears as

 24-

 See rfc2855 for details.

 There's also I completely different format for DHCPv6. If DHCPv6 is in use
 then the IPv4 leases will be terminated with a line like this:

 duid server DUID as colon-separated hex

 and then there will follow the DHCPv6 leases as

 1) Expiry time
 2) IAID
 3) IPv6 address
 4) hostname
 5) client DUID



In case of DHCPv6, which of the above 5 fields can be missing (for
IPv6 addresses)?





 Cheers,

 Simon.



 ___
 Dnsmasq-discuss mailing list
 Dnsmasq-discuss@lists.thekelleys.org.uk
 http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss



-- 
Nehal J Wani
UG3, BTech CS+MS(CL)
IIIT-Hyderabad
http://commandlinewani.blogspot.com

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Reg: Info related to leases file

2013-09-24 Thread Nehal J Wani
On Tue, Sep 24, 2013 at 3:37 PM, Simon Kelley si...@thekelleys.org.uk wrote:
 On 24/09/13 10:48, Nehal J Wani wrote:

 On Tue, Sep 24, 2013 at 1:15 AM, Simon Kelleysi...@thekelleys.org.uk
 wrote:

 On 23/09/13 19:12, Nehal J Wani wrote:


 If I am not wrong, there are 5 fields in a dnsmasq/network-name.leases
 file:

 (i) Expiry time
 (ii) MAC Address
 (iii) IP Address
 (iv) Hostname
 (v) Client ID

 Q1: Is the above order fixed?
 Q2: Which values from above can be NULL? (I know that leases contains
 '*' for fields whose values are not known, but is it safe to assume
 that it will be '*' for any value that is unknown?)


 A1: Yes.

 A2: There will always be an expiry time and an IP address. The hostname
 and
 the client-id can be missing, in which case the fields will contain *.

 The Mac address may have a hardware type (rfc1060) appended like so:

 02-01:02:03:04:05:06

 If the hardware type is 01 (ethernet), then it's omitted

 For IEEE1394 clients, the hardware type is 24, and the length of the MAC
 address is zero, so this appears as

 24-

 See rfc2855 for details.

 There's also I completely different format for DHCPv6. If DHCPv6 is in
 use
 then the IPv4 leases will be terminated with a line like this:

 duidserver DUID  as colon-separated hex

 and then there will follow the DHCPv6 leases as

 1) Expiry time
 2) IAID
 3) IPv6 address
 4) hostname
 5) client DUID



 In case of DHCPv6, which of the above 5 fields can be missing (for
 IPv6 addresses)?


 Only the hostname, which can be replaced with * if no hostname is known.
 All the others are required.

 For both IPv4 and IPv6 leases, the expiry time can be zero which means
 never.


Out of the three types:  DUID-LLT, DUID-EN and DUID-LL, which one is
used by dnsmasq? I am asking because I want to confirm whether the MAC
address of the network interface is always a substring of the client
DUID or not.


 Cheers,

 Simon.








 Cheers,

 Simon.



 ___
 Dnsmasq-discuss mailing list
 Dnsmasq-discuss@lists.thekelleys.org.uk
 http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss








-- 
Nehal J Wani
UG3, BTech CS+MS(CL)
IIIT-Hyderabad
http://commandlinewani.blogspot.com

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


[Dnsmasq-discuss] Reg: Info related to leases file

2013-09-23 Thread Nehal J Wani
If I am not wrong, there are 5 fields in a dnsmasq/network-name.leases file:

(i) Expiry time
(ii) MAC Address
(iii) IP Address
(iv) Hostname
(v) Client ID

Q1: Is the above order fixed?
Q2: Which values from above can be NULL? (I know that leases contains
'*' for fields whose values are not known, but is it safe to assume
that it will be '*' for any value that is unknown?)

-- 
Nehal J Wani
UG3, BTech CS+MS(CL)
IIIT-Hyderabad
http://commandlinewani.blogspot.com

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Reg: Info related to leases file

2013-09-23 Thread Nehal J Wani
On Tue, Sep 24, 2013 at 1:15 AM, Simon Kelley si...@thekelleys.org.uk wrote:
 On 23/09/13 19:12, Nehal J Wani wrote:

 If I am not wrong, there are 5 fields in a dnsmasq/network-name.leases
 file:

 (i) Expiry time
 (ii) MAC Address
 (iii) IP Address
 (iv) Hostname
 (v) Client ID

 Q1: Is the above order fixed?
 Q2: Which values from above can be NULL? (I know that leases contains
 '*' for fields whose values are not known, but is it safe to assume
 that it will be '*' for any value that is unknown?)


 A1: Yes.

 A2: There will always be an expiry time and an IP address. The hostname and
 the client-id can be missing, in which case the fields will contain *.

 The Mac address may have a hardware type (rfc1060) appended like so:

 02-01:02:03:04:05:06

 If the hardware type is 01 (ethernet), then it's omitted

 For IEEE1394 clients, the hardware type is 24, and the length of the MAC
 address is zero, so this appears as

 24-

 See rfc2855 for details.

 There's also I completely different format for DHCPv6. If DHCPv6 is in use
 then the IPv4 leases will be terminated with a line like this:

 duid server DUID as colon-separated hex

 and then there will follow the DHCPv6 leases as

 1) Expiry time
 2) IAID
 3) IPv6 address
 4) hostname
 5) client DUID




Could you give an example of the DHCPv6 leases file with IPv4 as well
as IPv6 addresses?






 Cheers,

 Simon.



 ___
 Dnsmasq-discuss mailing list
 Dnsmasq-discuss@lists.thekelleys.org.uk
 http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss



-- 
Nehal J Wani
UG3, BTech CS+MS(CL)
IIIT-Hyderabad
http://commandlinewani.blogspot.com

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


[Dnsmasq-discuss] Fwd: Reg: Max Length if an entry

2013-07-25 Thread Nehal J. Wani
I am implementing a public API in libvirt as part of my GSoC project, for
which I need to parse the dnsmasq/network-name.leases file.

I would like to know the maximum length that an entry can have in the
leases file.

Thanking You,
Nehal J. Wani
UG3, BTech CS+MS(CL)
IIIT-Hyderabad
http://commandlinewani.blogspot.com
___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss