Re: [Dnsmasq-discuss] Dnsmasq stops resolving addresses after return from suspend and wlan re-assoc

2014-12-15 Thread Toke Høiland-Jørgensen
Simon Kelley si...@thekelleys.org.uk writes:

 Try git now. realpath() is my friend.

Seems to work; I get the expected bunch of reloads of the file upon
returning from suspend, picking up the right nameserver once it appears.

Thanks a bunch! :)

-Toke

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


Re: [Dnsmasq-discuss] Dnsmasq stops resolving addresses after return from suspend and wlan re-assoc

2014-12-15 Thread Simon Kelley
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Try git now. realpath() is my friend.


Cheers,

Simon.


On 12/12/14 09:11, Toke Høiland-Jørgensen wrote:
 Simon Kelley si...@thekelleys.org.uk writes:
 
 That sounds sensible, I shall continue my tour around the
 farther reaches of the Unix file API. Later
 
 Great, thanks! I'll use the direct path in the meantime :)
 
 -Toke
 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1

iQIcBAEBCAAGBQJUjxDPAAoJEBXN2mrhkTWiaMgP/A/cYTApmGTN9RXGCYwsuBcB
ycyUl1jy9VFUqqQz74K+9AVM1kupi1CLbGObty9+LbsjH12T9t8Md3BfDLU8EICb
W980jVCpkOuW45h6Nvm01Ry7RMryhahY5rXux8iP/oXFcnagwpOjjDPYLRigaMKw
aAt0JhsULbam8fAREvn8eufUq+nHU8hzwGo0XCwYOfgRfbVJt6KG7RRA1dgOXRBN
5gVGBEQhQ3KbQWoPm4yv/HuYFoGUb2N9a5jPQo2slTkZMY7T8JoD1OZJXg1PniND
HYL1iySJ9frrEwjwRJKt6iGm6RqkLZFRb8oVSeEVo3mhwsE1e2Srchn85f0Ta2I1
P8TtoXzi9K7kI2LqaorfIOAtNicwOKv/CdENm14FwqlIbrZXjD2t2EZh8bLgHZjW
cFm7v/FEtxE6RnKFaLT5HdCIREUrh3LxodDppbEetdASBdxJxAvsm388cKjV5Kcd
AaSqatCgasxh6BhgX1fYIzwLf+GW3mc+j+Qki8ofSGyCpf/MHKZQaOEYlssGgLnk
dke8V+9ZdvGNe3Bg2fvyb4hX8SRkaA9F1zkeDITrixLmZPzVc1aHZ2VkiLJ0XmYb
MVc4UU1qg88JaHL12d0rV59mP2hUIInI1AyS6YM26Hn3eOwcTd15hcN1tUYIkff3
ZF+TCASDmQkSpyw0Fp/0
=JhBl
-END PGP SIGNATURE-

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


Re: [Dnsmasq-discuss] Dnsmasq stops resolving addresses after return from suspend and wlan re-assoc

2014-12-12 Thread Toke Høiland-Jørgensen
Simon Kelley si...@thekelleys.org.uk writes:

 I just pushed code into git which uses inotify to track changes.
 Dnsmasq should now re-read the file whenever it is closed after being
 open for write, or when it's moved into the parent directory.

 I'm pretty sure (unless I've done it wrong) that this will fix your
 problem. Please could you try it?

Hmm, the problem remains even with the inotify patch. This is what I see
in my syslog after a return from suspend:

Dec 12 08:05:04 alrua-x1 kernel: wlan0: associated
Dec 12 08:05:06 alrua-x1 wpa_actiond[2303]: Interface 'wlan0' reestablished 
connection to network 'tohojo'
Dec 12 08:05:06 alrua-x1 systemd-networkd[1841]: wlan0   : gained 
carrier
Dec 12 08:05:06 alrua-x1 systemd-networkd[1841]: wlan0   : DHCPv4 
address 10.42.8.59/27 via 10.42.8.33
Dec 12 08:05:06 alrua-x1 avahi-daemon[2720]: Joining mDNS multicast group on 
interface wlan0.IPv4 with address 10.42.8.59.
Dec 12 08:05:06 alrua-x1 dnsmasq[5465]: reading /etc/dnsmasq-resolv.conf
Dec 12 08:05:06 alrua-x1 avahi-daemon[2720]: New relevant interface wlan0.IPv4 
for mDNS.
Dec 12 08:05:06 alrua-x1 avahi-daemon[2720]: Registering new address record for 
10.42.8.59 on wlan0.IPv4.
Dec 12 08:05:06 alrua-x1 dnsmasq[5465]: ignoring nameserver 127.0.0.1 - local 
interface

Looking at the file:

$ cat /etc/dnsmasq-resolv.conf 
# This file is managed by systemd-resolved(8). Do not edit.
#
# Third party programs must not access this file directly, but
# only through the symlink at /etc/resolv.conf. To manage
# resolv.conf(5) in a different way, replace the symlink by a
# static file or a different symlink.

nameserver 127.0.0.1
nameserver 10.42.8.33


I'm guessing it might have something to do with this:

$ ls -l /etc/dnsmasq-resolv.conf 
4,0K lrwxrwxrwx 1 root root 32 Jun 26 18:19 /etc/dnsmasq-resolv.conf - 
/run/systemd/resolve/resolv.conf

Changing the dnsmasq conf to point to /run/systemd/resolve/resolv.conf
directly, things seem to work right; I see seven reloads of the file
after returning from suspend, the last one picking up the right
nameserver...

Maybe dnsmasq should resolve symlinks before setting up the inotify?

-Toke

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


Re: [Dnsmasq-discuss] Dnsmasq stops resolving addresses after return from suspend and wlan re-assoc

2014-12-12 Thread Simon Kelley
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256



On 12/12/14 07:17, Toke Høiland-Jørgensen wrote:
 Simon Kelley si...@thekelleys.org.uk writes:
 
 I just pushed code into git which uses inotify to track changes. 
 Dnsmasq should now re-read the file whenever it is closed after
 being open for write, or when it's moved into the parent
 directory.
 
 I'm pretty sure (unless I've done it wrong) that this will fix
 your problem. Please could you try it?
 
 Hmm, the problem remains even with the inotify patch. This is what
 I see in my syslog after a return from suspend:
 
 Dec 12 08:05:04 alrua-x1 kernel: wlan0: associated Dec 12 08:05:06
 alrua-x1 wpa_actiond[2303]: Interface 'wlan0' reestablished
 connection to network 'tohojo' Dec 12 08:05:06 alrua-x1
 systemd-networkd[1841]: wlan0   : gained carrier Dec 12
 08:05:06 alrua-x1 systemd-networkd[1841]: wlan0   : DHCPv4
 address 10.42.8.59/27 via 10.42.8.33 Dec 12 08:05:06 alrua-x1
 avahi-daemon[2720]: Joining mDNS multicast group on interface
 wlan0.IPv4 with address 10.42.8.59. Dec 12 08:05:06 alrua-x1
 dnsmasq[5465]: reading /etc/dnsmasq-resolv.conf Dec 12 08:05:06
 alrua-x1 avahi-daemon[2720]: New relevant interface wlan0.IPv4 for
 mDNS. Dec 12 08:05:06 alrua-x1 avahi-daemon[2720]: Registering new
 address record for 10.42.8.59 on wlan0.IPv4. Dec 12 08:05:06
 alrua-x1 dnsmasq[5465]: ignoring nameserver 127.0.0.1 - local
 interface
 
 Looking at the file:
 
 $ cat /etc/dnsmasq-resolv.conf # This file is managed by
 systemd-resolved(8). Do not edit. # # Third party programs must not
 access this file directly, but # only through the symlink at
 /etc/resolv.conf. To manage # resolv.conf(5) in a different way,
 replace the symlink by a # static file or a different symlink.
 
 nameserver 127.0.0.1 nameserver 10.42.8.33
 
 
 I'm guessing it might have something to do with this:
 
 $ ls -l /etc/dnsmasq-resolv.conf 4,0K lrwxrwxrwx 1 root root 32 Jun
 26 18:19 /etc/dnsmasq-resolv.conf -
 /run/systemd/resolve/resolv.conf
 
 Changing the dnsmasq conf to point to
 /run/systemd/resolve/resolv.conf directly, things seem to work
 right; I see seven reloads of the file after returning from
 suspend, the last one picking up the right nameserver...
 
 Maybe dnsmasq should resolve symlinks before setting up the
 inotify?
 

That sounds sensible, I shall continue my tour around the farther
reaches of the Unix file API. Later


Cheers,

Simon.

 -Toke
 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1

iQIcBAEBCAAGBQJUiqa9AAoJEBXN2mrhkTWisv0P/2FwLjkbbME3Jiu+Q0Yzoib/
0EDKZO91oL3Mr8EdzRopCVCK4W4G7Unfj/PQNGF13bX+OCIOSAymDdZlaS93OmIN
2leJ6GbO/bATGERTvjyMafbmCUPJFXs1QreFQ7QEsYVISUV2clr6W0IuKfcSLw7b
SLkjAlG22/WNK/SH84hSUlZ2IZ1OcXcqluoGTdZVPy3nFR1T1iHic/PAOq1c+Jls
7eD2cbX4526bRmdVLvFrAsZvQYepVTknTpIuIT0Xxj6VBd01UcOSoAuuWEgJNFW2
KnRYslzVAL6LXvolN4rATmJ4aw8/1QAI/2WDCV4IyJ0EOgIBoB3InbgjNZCPfcGD
amqMY4Dddd75BocJY6KLqkcPExmYwefQyJqkO5Nq0T2u8K2HL8PoLvLSCtnwZspw
OWNdGkb5brMLtE7dPEhUtrOFQCkk+iel+b8eQ4FUeKkGy8/JchwSWqjsLtlpsu2m
S4T4EWN2DSksRJPnyYg0TX7bWqvDZHNgYKTEBtBlRcs+XAOcLXdMxGYIp9HE8s7O
rgL+aUxksRoxmFvYRs6mKk9/NqFzNoZ7Rdgptx8VXYR6SVQYogqYkse9xfWIPFzb
8kdMm1DTNC7t86G8g3X/EgbwjXyrgwj5759kLomOjv9RHi0YSUcjvs8WVLzDPbo0
VgzXYyJNt59Nfzq0FDJH
=pTL8
-END PGP SIGNATURE-

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


Re: [Dnsmasq-discuss] Dnsmasq stops resolving addresses after return from suspend and wlan re-assoc

2014-12-12 Thread Toke Høiland-Jørgensen
Simon Kelley si...@thekelleys.org.uk writes:

 That sounds sensible, I shall continue my tour around the farther
 reaches of the Unix file API. Later

Great, thanks! I'll use the direct path in the meantime :)

-Toke

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


Re: [Dnsmasq-discuss] Dnsmasq stops resolving addresses after return from suspend and wlan re-assoc

2014-12-10 Thread Simon Kelley
Hi Toke,

I just pushed code into git which uses inotify to track changes. Dnsmasq
should now re-read  the file whenever it is closed after being open for
write, or when it's moved into the parent directory.

I'm pretty sure (unless I've done it wrong) that this will fix your
problem. Please could you try it?

I now need to go back and re-read the nanosecond patch and consider if
this solves that too.



Cheers,

Simon.



On 02/12/14 17:12, Toke Høiland-Jørgensen wrote:
 Friendly bump on this? :)
 
 -Toke
 
 I've been bothered for a while that my laptop (which runs a local
 dnsmasq instance for caching) stops resolving names after returning from
 suspend, and sometimes spontaneously as well. Restarting dnsmasq would
 always fix this.

 It finally started bothering me enough to debug it, and what I think
 happens is something like this:

 - Dnsmasq is configured to use the resolv.conf file maintained by
   systemd-resolved, the nameserver manager component of
   systemd-networkd. This file is updated whenever nameservers change
   from DHCP or configuration.

 - Sometimes, it seems, systemd-resolved rewrites this file twice within
   a fairly short time; once empty and again shortly after with the right
   nameservers. Dnsmasq only picks up the first rewrite:

 Oct 19 19:44:50 alrua-x1 dnsmasq[30391]: reading /etc/dnsmasq-resolv.conf
 Oct 19 19:44:50 alrua-x1 dnsmasq[30391]: ignoring nameserver 127.0.0.1 - 
 local interface

 But subsequently touching the file makes dnsmasq pick up on the change
 and name resolution works again:

 Oct 19 19:49:30 alrua-x1 sudo[2104]: alrua : TTY=pts/4 ; PWD=/home/alrua ; 
 USER=root ; COMMAND=/usr/bin/touch /run/systemd/resolve/resolv.conf
 Oct 19 19:49:30 alrua-x1 sudo[2104]: pam_unix(sudo:session): session opened 
 for user root by (uid=0)
 Oct 19 19:49:30 alrua-x1 sudo[2104]: pam_unix(sudo:session): session closed 
 for user root
 Oct 19 19:49:33 alrua-x1 dnsmasq[30391]: reading /etc/dnsmasq-resolv.conf
 Oct 19 19:49:33 alrua-x1 dnsmasq[30391]: ignoring nameserver 127.0.0.1 - 
 local interface
 Oct 19 19:49:33 alrua-x1 dnsmasq[30391]: using nameserver 10.61.32.1#53
 Oct 19 19:49:33 alrua-x1 dnsmasq[30391]: using nameserver 1.1.1.1#53

 Oddly enough, when first connecting to a network, there's a delay
 between the two writes of the resolv-file, which means things work:

 Oct 19 20:05:59 alrua-x1 systemd-networkd[960]: wlan0   : gained 
 carrier
 Oct 19 20:05:59 alrua-x1 systemd-networkd[960]: wlan0   : DHCPv4 
 address 10.71.0.250/20 via 10.71.0.1
 Oct 19 20:05:59 alrua-x1 dnsmasq[22661]: reading /etc/dnsmasq-resolv.conf
 Oct 19 20:05:59 alrua-x1 dnsmasq[22661]: ignoring nameserver 127.0.0.1 - 
 local interface
 Oct 19 20:06:03 alrua-x1 dnsmasq[22661]: reading /etc/dnsmasq-resolv.conf
 Oct 19 20:06:03 alrua-x1 dnsmasq[22661]: ignoring nameserver 127.0.0.1 - 
 local interface
 Oct 19 20:06:03 alrua-x1 dnsmasq[22661]: using nameserver 10.61.32.1#53
 Oct 19 20:06:03 alrua-x1 dnsmasq[22661]: using nameserver 1.1.1.1#53

 Either way, fixing dnsmasq to always notice the updated files would be
 desirable. Not sure if the recently posted nanosecond resolution patch
 is the way to go about it, but consider this a motivation to do
 *something* :)

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


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


Re: [Dnsmasq-discuss] Dnsmasq stops resolving addresses after return from suspend and wlan re-assoc

2014-12-02 Thread Toke Høiland-Jørgensen
Friendly bump on this? :)

-Toke

 I've been bothered for a while that my laptop (which runs a local
 dnsmasq instance for caching) stops resolving names after returning from
 suspend, and sometimes spontaneously as well. Restarting dnsmasq would
 always fix this.

 It finally started bothering me enough to debug it, and what I think
 happens is something like this:

 - Dnsmasq is configured to use the resolv.conf file maintained by
   systemd-resolved, the nameserver manager component of
   systemd-networkd. This file is updated whenever nameservers change
   from DHCP or configuration.

 - Sometimes, it seems, systemd-resolved rewrites this file twice within
   a fairly short time; once empty and again shortly after with the right
   nameservers. Dnsmasq only picks up the first rewrite:

 Oct 19 19:44:50 alrua-x1 dnsmasq[30391]: reading /etc/dnsmasq-resolv.conf
 Oct 19 19:44:50 alrua-x1 dnsmasq[30391]: ignoring nameserver 127.0.0.1 - 
 local interface

 But subsequently touching the file makes dnsmasq pick up on the change
 and name resolution works again:

 Oct 19 19:49:30 alrua-x1 sudo[2104]: alrua : TTY=pts/4 ; PWD=/home/alrua ; 
 USER=root ; COMMAND=/usr/bin/touch /run/systemd/resolve/resolv.conf
 Oct 19 19:49:30 alrua-x1 sudo[2104]: pam_unix(sudo:session): session opened 
 for user root by (uid=0)
 Oct 19 19:49:30 alrua-x1 sudo[2104]: pam_unix(sudo:session): session closed 
 for user root
 Oct 19 19:49:33 alrua-x1 dnsmasq[30391]: reading /etc/dnsmasq-resolv.conf
 Oct 19 19:49:33 alrua-x1 dnsmasq[30391]: ignoring nameserver 127.0.0.1 - 
 local interface
 Oct 19 19:49:33 alrua-x1 dnsmasq[30391]: using nameserver 10.61.32.1#53
 Oct 19 19:49:33 alrua-x1 dnsmasq[30391]: using nameserver 1.1.1.1#53

 Oddly enough, when first connecting to a network, there's a delay
 between the two writes of the resolv-file, which means things work:

 Oct 19 20:05:59 alrua-x1 systemd-networkd[960]: wlan0   : gained 
 carrier
 Oct 19 20:05:59 alrua-x1 systemd-networkd[960]: wlan0   : DHCPv4 
 address 10.71.0.250/20 via 10.71.0.1
 Oct 19 20:05:59 alrua-x1 dnsmasq[22661]: reading /etc/dnsmasq-resolv.conf
 Oct 19 20:05:59 alrua-x1 dnsmasq[22661]: ignoring nameserver 127.0.0.1 - 
 local interface
 Oct 19 20:06:03 alrua-x1 dnsmasq[22661]: reading /etc/dnsmasq-resolv.conf
 Oct 19 20:06:03 alrua-x1 dnsmasq[22661]: ignoring nameserver 127.0.0.1 - 
 local interface
 Oct 19 20:06:03 alrua-x1 dnsmasq[22661]: using nameserver 10.61.32.1#53
 Oct 19 20:06:03 alrua-x1 dnsmasq[22661]: using nameserver 1.1.1.1#53

 Either way, fixing dnsmasq to always notice the updated files would be
 desirable. Not sure if the recently posted nanosecond resolution patch
 is the way to go about it, but consider this a motivation to do
 *something* :)

 -Toke

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


[Dnsmasq-discuss] Dnsmasq stops resolving addresses after return from suspend and wlan re-assoc

2014-10-19 Thread Toke Høiland-Jørgensen
I've been bothered for a while that my laptop (which runs a local
dnsmasq instance for caching) stops resolving names after returning from
suspend, and sometimes spontaneously as well. Restarting dnsmasq would
always fix this.

It finally started bothering me enough to debug it, and what I think
happens is something like this:

- Dnsmasq is configured to use the resolv.conf file maintained by
  systemd-resolved, the nameserver manager component of
  systemd-networkd. This file is updated whenever nameservers change
  from DHCP or configuration.

- Sometimes, it seems, systemd-resolved rewrites this file twice within
  a fairly short time; once empty and again shortly after with the right
  nameservers. Dnsmasq only picks up the first rewrite:

Oct 19 19:44:50 alrua-x1 dnsmasq[30391]: reading /etc/dnsmasq-resolv.conf
Oct 19 19:44:50 alrua-x1 dnsmasq[30391]: ignoring nameserver 127.0.0.1 - local 
interface

But subsequently touching the file makes dnsmasq pick up on the change
and name resolution works again:

Oct 19 19:49:30 alrua-x1 sudo[2104]: alrua : TTY=pts/4 ; PWD=/home/alrua ; 
USER=root ; COMMAND=/usr/bin/touch /run/systemd/resolve/resolv.conf
Oct 19 19:49:30 alrua-x1 sudo[2104]: pam_unix(sudo:session): session opened for 
user root by (uid=0)
Oct 19 19:49:30 alrua-x1 sudo[2104]: pam_unix(sudo:session): session closed for 
user root
Oct 19 19:49:33 alrua-x1 dnsmasq[30391]: reading /etc/dnsmasq-resolv.conf
Oct 19 19:49:33 alrua-x1 dnsmasq[30391]: ignoring nameserver 127.0.0.1 - local 
interface
Oct 19 19:49:33 alrua-x1 dnsmasq[30391]: using nameserver 10.61.32.1#53
Oct 19 19:49:33 alrua-x1 dnsmasq[30391]: using nameserver 1.1.1.1#53


Oddly enough, when first connecting to a network, there's a delay
between the two writes of the resolv-file, which means things work:

Oct 19 20:05:59 alrua-x1 systemd-networkd[960]: wlan0   : gained carrier
Oct 19 20:05:59 alrua-x1 systemd-networkd[960]: wlan0   : DHCPv4 
address 10.71.0.250/20 via 10.71.0.1
Oct 19 20:05:59 alrua-x1 dnsmasq[22661]: reading /etc/dnsmasq-resolv.conf
Oct 19 20:05:59 alrua-x1 dnsmasq[22661]: ignoring nameserver 127.0.0.1 - local 
interface
Oct 19 20:06:03 alrua-x1 dnsmasq[22661]: reading /etc/dnsmasq-resolv.conf
Oct 19 20:06:03 alrua-x1 dnsmasq[22661]: ignoring nameserver 127.0.0.1 - local 
interface
Oct 19 20:06:03 alrua-x1 dnsmasq[22661]: using nameserver 10.61.32.1#53
Oct 19 20:06:03 alrua-x1 dnsmasq[22661]: using nameserver 1.1.1.1#53


Either way, fixing dnsmasq to always notice the updated files would be
desirable. Not sure if the recently posted nanosecond resolution patch
is the way to go about it, but consider this a motivation to do
*something* :)

-Toke

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