/dev/null | egrep -o '([0-9]{1,3}\.){3}[0-9]{1,3}' | egrep -v '255|(127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})')\n ath0=$(ifconfig ath0 2>/dev/null | egrep -o '([0-9]{1,3}\.){3}[0-9]{1,3}' | egrep -v '255|(127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})')\n ath1=$(ifconfig ath1 2>/dev/null | egrep -o '([0-9]{1,3}\.){3}[0-9]{1,3}' | egrep -v '255|(127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})')\n ppp0=$(ifconfig ppp0 2>/dev/null | egrep -o '([0-9]{1,3}\.){3}[0-9]{1,3}' | egrep -v '255|(127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})')\n "; fwrite($fp,$init_rule); foreach($rules as $rule) { $join_array=explode('|',trim($rule)); write_rule($join_array,'0',$fp); } fclose($fp); } function delete_join_rule($rule_number,$conf_file='',$rules_file='') { global $base_plugin; $interfaces=parse_interfaces('/etc/network/interfaces'); if ($conf_file=='') { $conf_file=$base_plugin.'data/join.conf'; } if ($rules_file=='') { $rules_file=$base_plugin.'data/join_rules.conf'; } // Load old config file and unset rule number. $rules=file($conf_file); unset($rules[$rule_number]); // Rewrite the configuration file without rule number. $fp=fopen($conf_file,"w"); foreach($rules as $rule) { fwrite($fp,$rule); } fclose($fp); unset($fp); $fp=fopen($rules_file,"w"); $init_rule="#!/bin/bash\n eth0=$(ifconfig eth0 2>/dev/null | egrep -o '([0-9]{1,3}\.){3}[0-9]{1,3}' | egrep -v '255|(127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})')\n ath0=$(ifconfig ath0 2>/dev/null | egrep -o '([0-9]{1,3}\.){3}[0-9]{1,3}' | egrep -v '255|(127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})')\n ath1=$(ifconfig ath1 2>/dev/null | egrep -o '([0-9]{1,3}\.){3}[0-9]{1,3}' | egrep -v '255|(127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})')\n ppp0=$(ifconfig ppp0 2>/dev/null | egrep -o '([0-9]{1,3}\.){3}[0-9]{1,3}' | egrep -v '255|(127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})')\n "; fwrite($fp,$init_rule); foreach($rules as $rule) { $join_array=explode('|',trim($rule)); write_rule($join_array,'0',$fp); } fclose($fp); } ?>