From: Jo-Philipp Wich Date: Thu, 10 Oct 2013 14:58:12 +0000 (+0000) Subject: ppp: correct module loaded check in proto_pptp_setup X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fsvn-archive%2Farchive.git;a=commitdiff_plain;hb=2c49d70703e04a9fb654f389a75e49e9060719e0 ppp: correct module loaded check in proto_pptp_setup proto_pptp_setup is responsible for loading the required modules to establish a pptp connection to a foreign peer. The function checks whether all required modules are already loaded, before actually loading them. It seems that the filter being used to accomplish this, is not restrictive enough in some cases. For instance when pptp nat helper modules are present on a system, and already loaded before a pptp connection is enabled. Then the search filter (possibly) returns the following for module=pptp, where actually no matches are expected, resulting in the pptp.ko module not being loaded, thereby failing to establish the pptp connection. # module="pptp" ; grep "$module" /proc/modules nf_nat_pptp 1312 0 - Live 0x86ce7000 nf_conntrack_pptp 3072 1 nf_nat_pptp, Live 0x86cb9000 nf_nat_proto_gre 784 1 nf_nat_pptp, Live 0x86cba000 nf_conntrack_proto_gre 2368 1 nf_conntrack_pptp, Live 0x86cbf000 nf_nat 9792 13 nf_nat_rtsp,nf_nat_tftp,nf_nat_sip,nf_nat_pptp,nf_nat_h323,nf_nat_proto_gre,nf_nat_amanda,nf_nat_irc,nf_nat_ftp,ipt_REDIRECT,ipt_NETMAP,ipt_MASQUERADE,iptable_nat, Live 0x86ca8000 nf_conntrack 37264 31 nf_nat_rtsp,nf_conntrack_rtsp,nf_nat_tftp,nf_conntrack_tftp,nf_nat_snmp_basic,nf_conntrack_snmp,nf_nat_sip,nf_conntrack_sip,nf_nat_pptp,nf_conntrack_pptp,nf_nat_h323,nf_conntrack_h323,nf_conntrack_proto_gre,nf_nat_amanda,nf_conntrack_amanda,nf_conntrack_broadcast,nf_nat_irc,nf_conntrack_irc,nf_nat_ftp,nf_conntrack_ftp,ipt_MASQUERADE,iptable_nat,nf_nat,xt_helper,xt_connmark,xt_connbytes,xt_conntrack,xt_CT,xt_NOTRACK,xt_state,nf_conntrack_ipv4, Live 0x86c90000 The search filter can be made more accurate/restrictive, by requiring the occurance of the exact name of the module at the beginning of a line in /proc/modules. # module="pptp" ; grep "^$module " /proc/modules pptp 13296 2 - Live 0x86e80000 Signed-off-by: Tijs Van Buggenhout SVN-Revision: 38358 --- diff --git a/package/network/services/ppp/files/ppp.sh b/package/network/services/ppp/files/ppp.sh index 43a7de9658..02b40558ca 100755 --- a/package/network/services/ppp/files/ppp.sh +++ b/package/network/services/ppp/files/ppp.sh @@ -190,7 +190,7 @@ proto_pptp_setup() { local load for module in slhc ppp_generic ppp_async ppp_mppe ip_gre gre pptp; do - grep -q "$module" /proc/modules && continue + grep -q "^$module " /proc/modules && continue /sbin/insmod $module 2>&- >&- load=1 done