Blame SOURCES/ebtables.systemd

b43dd3
#!/bin/bash
b43dd3
b43dd3
RETVAL=0
b43dd3
b43dd3
initialize() {
b43dd3
  # Initialize $TYPE tables
b43dd3
  echo -n $"  $TYPE tables: "
b43dd3
  if [ -r /etc/sysconfig/ebtables.$TYPE ]; then
b43dd3
    /sbin/ebtables -t $TYPE --atomic-file /etc/sysconfig/ebtables.$TYPE --atomic-commit > /dev/null || RETVAL=1
b43dd3
  else
b43dd3
    echo -n "not configured"
b43dd3
  fi
b43dd3
  if [ $RETVAL -eq 0 ]; then
b43dd3
    echo -n $"[  OK  ]"
b43dd3
    echo -ne "\r"
b43dd3
  else
b43dd3
    echo -n $"[FAILED]"
b43dd3
    echo -ne "\r"
b43dd3
  fi
b43dd3
}
b43dd3
b43dd3
case $1 in
b43dd3
  start)
b43dd3
   # Initialize	filter tables
b43dd3
   TYPE=filter
b43dd3
   initialize
b43dd3
 
b43dd3
   # Initialize NAT tables
b43dd3
   echo
b43dd3
   TYPE=nat
b43dd3
   initialize
b43dd3
b43dd3
   # Initialize broute tables
b43dd3
   echo
b43dd3
   TYPE=broute
b43dd3
   initialize
b43dd3
  ;;
b43dd3
  stop)
b43dd3
    /sbin/ebtables -t filter --init-table || RETVAL=1
b43dd3
    /sbin/ebtables -t nat --init-table || RETVAL=1
b43dd3
    /sbin/ebtables -t broute --init-table || RETVAL=1
b43dd3
b43dd3
    for mod in $(grep -E '^(ebt|ebtable)_' /proc/modules | cut -f1 -d' ') ebtables; do
b43dd3
       /sbin/rmmod $mod || RETVAL=1
b43dd3
    done
b43dd3
b43dd3
    if [ $RETVAL -eq 0 ]; then
b43dd3
      echo -n $"[  OK  ]"
b43dd3
      echo -ne "\r"
b43dd3
    else
b43dd3
      echo -n $"[FAILED]"
b43dd3
      echo -ne "\r"
b43dd3
    fi
b43dd3
  ;;
b43dd3
  save)
b43dd3
    echo -n $"Saving Ethernet bridge filtering (ebtables): "
b43dd3
    /sbin/ebtables -t filter --atomic-file /etc/sysconfig/ebtables.filter --atomic-save || RETVAL=1
b43dd3
    /sbin/ebtables -t nat --atomic-file /etc/sysconfig/ebtables.nat --atomic-save || RETVAL=1
b43dd3
    /sbin/ebtables -t broute --atomic-file /etc/sysconfig/ebtables.broute --atomic-save || RETVAL=1
b43dd3
    if [ $RETVAL -eq 0 ]; then
b43dd3
      echo -n $"[  OK  ]"
b43dd3
      echo -ne "\r"
b43dd3
    else
b43dd3
      echo -n $"[FAILED]"
b43dd3
      echo -ne "\r"
b43dd3
    fi
b43dd3
  ;;
b43dd3
  *)
b43dd3
    echo "usage: ${0##*/} {start|stop|save}" >&2
b43dd3
    exit 1
b43dd3
  ;;
b43dd3
esac
b43dd3
b43dd3
# vim:set ts=2 sw=2 ft=sh et: