Modify

Opened 8 years ago

Closed 8 years ago

Last modified 4 years ago

#6474 closed defect (fixed)

/tmp/resolv.conf.auto not created for ppp connections without peerdns

Reported by: MichaelPloujnikov <ploujj@…> Owned by: developers
Priority: normal Milestone: Barrier Breaker 14.07
Component: packages Version: Trunk
Keywords: Cc:

Description

Basically, if I have the following in /etc/config/network:

	option peerdns 0
	option dns	'208.67.222.222 208.67.220.220'

/tmp/resolv.conf.auto isn't generated with the hard-coded nameservers when I restart my pppoe connection. See this thread for more details: https://forum.openwrt.org/viewtopic.php?pid=99857#p99857

As that post says, my solution is to add this code to /lib/network/ppp.sh:

Index: package/ppp/files/ppp.sh
===================================================================
--- package/ppp/files/ppp.sh	(revision 19085)
+++ package/ppp/files/ppp.sh	(working copy)
@@ -54,6 +54,14 @@
 	config_get_bool peerdns "$cfg" peerdns 1 
 	[ "$peerdns" -eq 1 ] && peerdns="usepeerdns" || peerdns="" 
 	
+	config_get dns "$config" dns
+	[ -z "$dns" ] || {
+		for ns in $dns; do
+			grep "$ns" /tmp/resolv.conf.auto 2>/dev/null >/dev/null || {
+				echo "nameserver $ns" >> /tmp/resolv.conf.auto
+			}
+		done
+	}
 	config_get demand "$cfg" demand
 	[ -n "$demand" ] && echo "nameserver 1.1.1.1" > /tmp/resolv.conf.auto

This works for me, but maybe it needs some kind of clean up and protection from race conditions with other code that might generate /tmp/resolv.conf.auto.

Attachments (0)

Change History (2)

comment:1 Changed 8 years ago by jow

  • Resolution set to fixed
  • Status changed from new to closed

fixed in r19093

comment:2 Changed 4 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.