mirror of
https://github.com/firehol/firehol.git
synced 2024-06-30 19:02:21 +00:00
extended ipset option file to grep only ips (ipfile) or only nets (netfile)
This commit is contained in:
parent
1fdf21c109
commit
c15e5e76fe
@ -3829,8 +3829,12 @@ ipset() {
|
||||
shift
|
||||
;;
|
||||
|
||||
file)
|
||||
local file="${2}"
|
||||
file|ipfile|ipsfile|netfile|netsfile)
|
||||
local file="${2}" final_cmd="${CAT_CMD}"
|
||||
|
||||
[ "${1}" = "ipfile" -o "${1}" = "ipsfile" ] && final_cmd="${GREP_CMD} -v /"
|
||||
[ "${1}" = "netfile" -o "${1}" = "netsfile" ] && final_cmd="${GREP_CMD} /"
|
||||
|
||||
shift
|
||||
[ ! -f "${file}" ] && file="${FIREHOL_CONFIG_DIR}/${file}"
|
||||
if [ ! -f "${file}" ]
|
||||
@ -3840,6 +3844,8 @@ ipset() {
|
||||
fi
|
||||
${CAT_CMD} "${file}" |\
|
||||
${SED_CMD} -e "s/#.*$//g" -e "s/[\t\\ ]\+/ /g" -e "s/ \+$//g" -e "s/^ \+//g" |\
|
||||
${GREP_CMD} -v "^$" |\
|
||||
${final_cmd} |\
|
||||
${SORT_CMD} -u >>"${FIREHOL_DIR}/ipset.${name}.ips"
|
||||
;;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user