aboutsummaryrefslogtreecommitdiffstats
path: root/.gitignore
Commit message (Expand)AuthorAgeFilesLines
* build: add integration for managing opkg package feed keysFelix Fietkau2015-04-061-1/+2
* add git-src to .gitignoreJohn Crispin2014-01-121-1/+2
* .gitignore: Ignore Emacs editor generated filesVasilis Tsiligiannis2011-10-311-0/+4
* add vim temp files (*~) to .gitignoreJo-Philipp Wich2011-04-291-0/+1
* gitignore: add *.rej and *.orig to .gitignoreFlorian Fainelli2011-04-031-0/+2
* .gitignore: add *.o and .DS_Store by default - apparently some git versions d...Felix Fietkau2010-12-041-0/+2
* .gitignore: Undo accidental commit.Daniel Dickinson2010-05-101-0/+3
* brcm-2.4: Fixed preinit and failsafe switch configurationDaniel Dickinson2010-05-101-3/+0
* .gitignore: ignore vim swap filesFelix Fietkau2009-12-161-0/+1
* add logs/ to .gitignoreFelix Fietkau2009-04-241-0/+1
* add feeds.conf to .gitignoreFelix Fietkau2008-09-231-0/+1
* add missing gitignore change for build environmentsFelix Fietkau2008-08-061-0/+1
* update svn:ignore and .gitignoreFelix Fietkau2008-06-061-6/+6
* add package/openwrt-packages to .gitignoreFelix Fietkau2008-02-091-0/+1
* add package/feeds to .gitignoreFelix Fietkau2007-10-131-0/+1
* add feeds to .gitignoreFelix Fietkau2007-10-091-0/+1
* update svn and git ignore settingsFelix Fietkau2007-08-071-1/+1
* make top-level .gitignore only apply to top-level files/directories (#1960)Felix Fietkau2007-06-251-8/+8
* Add gitignore filesFelix Fietkau2007-05-291-0/+8
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
stop_interface_ppp() {
	local cfg="$1"

	local proto
	config_get proto "$cfg" proto

	local ifname
	config_get ifname "$cfg" ifname

	local link="${proto:-ppp}-$ifname"
	[ -f "/var/run/ppp-${link}.pid" ] && {
		local pid="$(head -n1 /var/run/ppp-${link}.pid 2>/dev/null)"
		grep -qs pppd "/proc/$pid/cmdline" && kill -TERM $pid
	}
}

start_pppd() {
	local cfg="$1"; shift

	local proto
	config_get proto "$cfg" proto

	# unique link identifier
	local link="${proto:-ppp}-$cfg"

	# make sure only one pppd process is started
	lock "/var/lock/ppp-${link}"
	local pid="$(head -n1 /var/run/ppp-${link}.pid 2>/dev/null)"
	[ -d "/proc/$pid" ] && grep pppd "/proc/$pid/cmdline" 2>/dev/null >/dev/null && {
		lock -u "/var/lock/ppp-${link}"
		return 0
	}

	# Workaround: sometimes hotplug2 doesn't deliver the hotplug event for creating
	# /dev/ppp fast enough to be used here
	[ -e /dev/ppp ] || mknod /dev/ppp c 108 0

	local device
	config_get device "$cfg" device

	local username
	config_get username "$cfg" username

	local password
	config_get password "$cfg" password

	local keepalive
	config_get keepalive "$cfg" keepalive

	local connect
	config_get connect "$cfg" connect

	local disconnect
	config_get disconnect "$cfg" disconnect

	local pppd_options
	config_get pppd_options "$cfg" pppd_options

	local defaultroute
	config_get_bool defaultroute "$cfg" defaultroute 1
	[ "$defaultroute" -eq 1 ] && \
		defaultroute="defaultroute replacedefaultroute" || defaultroute=""

	local interval="${keepalive##*[, ]}"
	[ "$interval" != "$keepalive" ] || interval=5

	local dns
	config_get dns "$config" dns

	local has_dns=0
	local peer_default=1
	[ -n "$dns" ] && {
		has_dns=1
		peer_default=0
	}

	local peerdns
	config_get_bool peerdns "$cfg" peerdns $peer_default

	echo -n "" > /tmp/resolv.conf.auto

	[ "$peerdns" -eq 1 ] && {
		peerdns="usepeerdns"
	} || {
		peerdns=""
		for dns in $dns; do
			echo "nameserver $dns" >> /tmp/resolv.conf.auto
		done
	}

	local demand
	config_get_bool demand "$cfg" demand 0

	local demandargs
	[ "$demand" -eq 1 ] && {
		demandargs="precompiled-active-filter /etc/ppp/filter demand idle"
		[ "$has_dns" -eq 0 ] && \
			echo "nameserver 1.1.1.1" > /tmp/resolv.conf.auto
	} || {
		demandargs="persist"
	}

	local ipv6
	config_get_bool ipv6 "$cfg" ipv6 0
	[ "$ipv6" -eq 1 ] && ipv6="+ipv6" || ipv6=""

	/usr/sbin/pppd "$@" \
		${keepalive:+lcp-echo-interval $interval lcp-echo-failure ${keepalive%%[, ]*}} \
		$demandargs \
		$peerdns \
		$defaultroute \
		${username:+user "$username" password "$password"} \
		linkname "$link" \
		ipparam "$cfg" \
		ifname "$link" \
		${connect:+connect "$connect"} \
		${disconnect:+disconnect "$disconnect"} \
		${ipv6} \
		${pppd_options}

	lock -u "/var/lock/ppp-${link}"
}

setup_interface_ppp() {
	local iface="$1"
	local config="$2"

	local device
	config_get device "$config" device

	local mtu
	config_get mtu "$config" mtu

	mtu=${mtu:-1492}
	start_pppd "$config" \
		mtu $mtu mru $mtu \
		"$device"
}