Re: [Dnsmasq-discuss] [PATCH] Fix parsing of IPv6 addresses with peer from netlink

2022-05-19 Thread Beniamino Galvani
On Wed, May 18, 2022 at 04:10:52PM +0200, Geert Stappers via Dnsmasq-discuss 
wrote:
> There new lines and one old line
> > +   if (rta->rta_type == IFA_LOCAL)
> > + addrp = ((struct in6_addr *)(rta+1));
> > +   else if (rta->rta_type == IFA_ADDRESS && !addrp)
> >   addrp = ((struct in6_addr *)(rta+1)); 
> rewritten as I see them
> +  if (conditionLOCAL)
> + addrp = value
> +  else if (conditionADDRESS && !addrp)
>   addrp = value
> 
> 
> It is the "&& !addrp" that makes me feel uncomfortable.
> 
> 
> Would
> +  if (conditionLOCAL)
> + addrp = value
> +  else if (conditionADDRESS)
>   addrp = value
> 
> do?

It wouldn't work, because a netlink message for an address with peer
has:

 IFA_LOCAL   = addr
 IFA_ADDRESS = peer

We would first evaluate IFA_LOCAL and set addrp = addr, then overwrite
it with peer when evaluating the next attribute IFA_ADDRESS.

Since we are interested in 'addr', when IFA_LOCAL is present it should
always override IFA_ADDRESS.

> P.S.
> @Beniamino   welcome to dnsmasq

Thanks,
Beniamino


signature.asc
Description: PGP signature
___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss


[Dnsmasq-discuss] dhcp-host=hostnameonly does not work

2022-05-19 Thread Maulis Adam via Dnsmasq-discuss

Hello,

I like to configure my dhcp server with as little redundacy as possible. 
But it looks like the IP address needs to be written both of /etc/hosts 
and /etc/dnsmasq.conf


The client machines are in the /etc/hosts for example:

192.168.64.200 cntemplate.hpc

The non-default dnsmasq config options are:

no-resolv
server=192.168.5.251
expand-hosts
domain=hpc

Case 1:
dhcp-range=192.168.64.0,static
dhcp-host=cntemplate

Does not work, syslog said:
May 19 15:53:47 gw00 dnsmasq-dhcp[4912]: DHCPDISCOVER(vlan164) 
02:00:00:00:00:65 no address available

Case 2:
dhcp-range=192.168.64.0,static
dhcp-host=cntemplate,192.168.64.200

Working, but needed a duplicate entry both of /etc/hosts and /etc/dnsmasq.conf

Case 3:
dhcp-range=192.168.64.100,192.168.64.250
dhcp-host=cntemplate,192.168.64.200

Working, but needed a duplicate entry both of /etc/hosts and /etc/dnsmasq.conf

Case 4:
dhcp-range=192.168.64.100,192.168.64.250
dhcp-host=cntemplate

Does not work, syslog said:
May 19 16:15:04 gw00 dnsmasq-dhcp[5282]: not giving name cntemplate.hpc to the 
DHCP lease of 192.168.64.215 because the name exists in /etc/hosts with address 
192.168.64.200





The client's DHCP requests (tcpdump)

02:00:00:00:00:65 > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 346: 
vlan 164, p 0, ethertype IPv4 (0x0800), (tos 0x10, ttl 128, id 0, offset 0, flags 
[none], proto UDP (17), length 328)
0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 
02:00:00:00:00:65, length 300, xid 0x619d4060, Flags [none]
  Client-Ethernet-Address 02:00:00:00:00:65
  Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message (53), length 1: Discover
Hostname (12), length 10: "cntemplate"
Parameter-Request (55), length 13:
  Subnet-Mask (1), BR (28), Time-Zone (2), Default-Gateway (3)
  Domain-Name (15), Domain-Name-Server (6), Unknown (119), Hostname 
(12)
  Netbios-Name-Server (44), Netbios-Scope (47), MTU (26), 
Classless-Static-Route (121)
  NTP (42)

Server's config:

ip addr show vlan164
6: vlan164@ens5:  mtu 1500 qdisc noqueue state 
UP group default qlen 1000
    link/ether 52:54:00:12:34:58 brd ff:ff:ff:ff:ff:ff
    inet 192.168.64.254/24 brd 192.168.64.255 scope global vlan164
   valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:fe12:3458/64 scope link
   valid_lft forever preferred_lft forever

cat /etc/debian_version
10.12

uname -a
Linux gw00 4.19.0-11-amd64 #1 SMP Debian 4.19.146-1 (2020-09-17) x86_64 
GNU/Linux

dpkg -l dnsmasq
ii  dnsmasq    2.80-1+deb10u1 all  Small caching DNS proxy and 
DHCP/TFTP server

I would be very happy with any advice

Adam Maulis


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


Re: [Dnsmasq-discuss] dhcp-host=hostnameonly does not work

2022-05-19 Thread john doe

On 5/19/2022 4:46 PM, Maulis Adam via Dnsmasq-discuss wrote:

Hello,

I like to configure my dhcp server with as little redundacy as possible.
But it looks like the IP address needs to be written both of /etc/hosts
and /etc/dnsmasq.conf

The client machines are in the /etc/hosts for example:

192.168.64.200 cntemplate.hpc

The non-default dnsmasq config options are:

no-resolv
server=192.168.5.251
expand-hosts
domain=hpc

Case 1:
dhcp-range=192.168.64.0,static
dhcp-host=cntemplate

Does not work, syslog said:
May 19 15:53:47 gw00 dnsmasq-dhcp[4912]: DHCPDISCOVER(vlan164)
02:00:00:00:00:65 no address available

Case 2:
dhcp-range=192.168.64.0,static
dhcp-host=cntemplate,192.168.64.200

Working, but needed a duplicate entry both of /etc/hosts and
/etc/dnsmasq.conf

Case 3:
dhcp-range=192.168.64.100,192.168.64.250
dhcp-host=cntemplate,192.168.64.200

Working, but needed a duplicate entry both of /etc/hosts and
/etc/dnsmasq.conf

Case 4:
dhcp-range=192.168.64.100,192.168.64.250
dhcp-host=cntemplate



I might be missing something here but why do you use the option
'dhcp-host' if you specify the hostname in '/etc/hosts'?

--
John Doe

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


Re: [Dnsmasq-discuss] dhcp-host=hostnameonly does not work

2022-05-19 Thread Michael Smith

On 5/19/22 07:46, Maulis Adam via Dnsmasq-discuss wrote:

Hello,

I like to configure my dhcp server with as little redundacy as 
possible. But it looks like the IP address needs to be written both of 
/etc/hosts and /etc/dnsmasq.conf


The client machines are in the /etc/hosts for example:

192.168.64.200 cntemplate.hpc

The non-default dnsmasq config options are:

no-resolv
server=192.168.5.251
expand-hosts
domain=hpc

Case 1:
dhcp-range=192.168.64.0,static
dhcp-host=cntemplate

Does not work, syslog said:
May 19 15:53:47 gw00 dnsmasq-dhcp[4912]: DHCPDISCOVER(vlan164) 
02:00:00:00:00:65 no address available



Maybe I am not fully understanding your use case.   Here is how I have 
mine configured:



hosts:

192.168.101.10    hostname


dnsmasq.conf

dhcp-host=0c:9d:92:10:a1:8c,hostname


This ties the DHCP request (MAC) to the hostname and then the hostname 
to the ip in the hosts file.



Michael



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