Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 615432 Details for
Bug 698746
net-firewall/iptables - /sbin/iptables symlink should be user-selectable
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
iptables.eselect
iptables.eselect (text/plain), 3.85 KB, created by
Chris Pritchard
on 2020-02-24 00:19:29 UTC
(
hide
)
Description:
iptables.eselect
Filename:
MIME Type:
Creator:
Chris Pritchard
Created:
2020-02-24 00:19:29 UTC
Size:
3.85 KB
patch
obsolete
># -*-eselect-*- vim: ft=eselect ># Copyright 2005-2019 Gentoo Authors ># Distributed under the terms of the GNU GPL version 2 or later > >DESCRIPTION="Manage the iptables and ip6tables symlink" >MAINTAINER="chris@christopherpritchard.co.uk" >VERSION="20200224" > >IPTABLES_TARGETS=("iptables" "iptables-restore" "iptables-save") >IP6TABLES_TARGETS=("ip6tables" "ip6tables-restore" "ip6tables-save") > ># find a list of xtables symlink targets >find_targets() { > local f > for f in "${EROOT}"/sbin/xtables-*-multi; do > [[ -f ${f} ]] && basename "${f}" > done >} > ># remove the iptables symlink >remove_symlinks() { > for ipt in ${IPTABLES_TARGETS[@]}; do > rm -f "${EROOT}"/sbin/${ipt} &>/dev/null > done > if [[ ${IPV6} -eq 1 ]]; then > for ip6t in ${IP6TABLES_TARGETS[@]}; do > rm -f "${EROOT}"/sbin/${ip6t} &>/dev/null > done > fi >} > ># set the iptables symlink >set_symlinks() { > local target=$1 > > if is_number "${target}" && [[ ${target} -ge 1 ]]; then > local targets=( $(find_targets) ) > target=${targets[target-1]} > fi > > [[ -z ${target} || ! -f ${EROOT}/sbin/${target} ]] \ > && die -q "Target \"$1\" doesn't appear to be valid!" > > for ipt in ${IPTABLES_TARGETS[@]}; do > ln -s "${target}" "${EROOT}/sbin/${ipt}" > done > if [[ ${IPV6} -eq 1 ]]; then > for ip6t in ${IP6TABLES_TARGETS[@]}; do > ln -s "${target}" "${EROOT}/sbin/${ip6t}" > done > fi >} > >### show action ### > >describe_show() { > echo "Show the current iptables symlink" >} > >do_show() { > if [[ -L ${EROOT}/sbin/ip6tables ]]; then > IPV6=1 > fi > write_list_start "Current iptables symlinks:" > for ipt in ${IPTABLES_TARGETS[@]}; do > if [[ -L ${EROOT}/sbin/${ipt} ]]; then > local ipta=$(canonicalise "${EROOT}/sbin/${ipt}") > write_kv_list_entry "${ipt}" "${ipta%/}" > else > write_kv_list_entry "${ipt}" "(unset)" > fi > done > if [[ ${IPV6} -eq 1 ]]; then > write_list_start "Current ip6tables symlinks:" > for ip6t in ${IP6TABLES_TARGETS[@]}; do > if [[ -L ${EROOT}/sbin/${ip6t} ]]; then > local ipta=$(canonicalise "${EROOT}/sbin/${ip6t}") > write_kv_list_entry "${ip6t}" "${ipta%/}" > else > write_kv_list_entry "${ip6t}" "(unset)" > fi > done > fi >} >### list action ### > >describe_list() { > echo "List available iptables symlink targets" >} > >do_list() { > local i targets=( $(find_targets) ) > if [[ -L ${EROOT}/sbin/ip6tables ]]; then > IPV6=1 > fi > write_list_start "Available iptables symlink targets:" > for (( i = 0; i < ${#targets[@]}; i++ )); do > # highlight the target where the symlink is pointing to > [[ ${targets[i]} = \ > $(basename "$(canonicalise "${EROOT}/sbin/iptables")") ]] \ > && targets[i]=$(highlight_marker "${targets[i]}") > done > write_numbered_list -m "(none found)" "${targets[@]}" >} > >### set action ### > >describe_set() { > echo "Set a new iptables symlink target" >} > >describe_set_parameters() { > echo "<target>" >} > >describe_set_options() { > echo "target : Target name or number (from 'list' action)" >} > >do_set() { > [[ -z $1 ]] && die -q "You didn't tell me what to set the symlink to" > [[ $# -gt 1 ]] && die -q "Too many parameters" > > if [[ -L ${EROOT}/sbin/ip6tables ]]; then > IPV6=1 > fi > if [[ -L ${EROOT}/sbin/iptables ]]; then > # existing symlink > remove_symlinks || die -q "Couldn't remove existing symlink" > set_symlinks "$1" || die -q "Couldn't set a new symlink" > elif [[ -e ${EROOT}/sbin/iptables ]]; then > # we have something strange > die -q "${EROOT}/sbin/iptables exists but is not a symlink" > else > set_symlinks "$1" || die -q "Couldn't set a new symlink" > fi >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 698746
:
615432
|
615434