Magellan Linux

Diff of /trunk/qemu-networking/qemu-networking.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2594 by niro, Tue Mar 4 10:12:48 2014 UTC revision 2595 by niro, Tue Mar 4 10:15:02 2014 UTC
# Line 35  checkconfig() Line 35  checkconfig()
35   return 1   return 1
36   fi   fi
37    
38     if systemctl --quiet is-active firewalld
39     then
40     if [ ! -x $(type -P firewall-cmd) ]
41     then
42     logger -s -p daemon.err -t qemu-networking.service \
43     "No 'firewall-cmd' executable found, please install 'net-misc/firewalld'"
44     return 1
45     fi
46     fi
47    
48   return 0   return 0
49  }  }
50    
# Line 47  case $1 in Line 57  case $1 in
57   ifconfig ${TAPDEV} ${VMROUTERIP} up   ifconfig ${TAPDEV} ${VMROUTERIP} up
58    
59   # maquerade and forward   # maquerade and forward
60   sysctl -q -w net.ipv4.ip_forward=1   if systemctl --quiet is-active firewalld
61   iptables -t nat -A POSTROUTING -s ${VMNETWORK} -o ${BRIDGEDEV} -j MASQUERADE   then
62     zone="$(firewall-cmd --get-zone-of-interface ${BRIDGEDEV})"
63     firewall-cmd --quiet --zone="${zone}" --add-masquerade
64     else
65     sysctl -q -w net.ipv4.ip_forward=1
66     iptables -t nat -A POSTROUTING -s ${VMNETWORK} -o ${BRIDGEDEV} -j MASQUERADE
67     fi
68   ;;   ;;
69    
70   stop)   stop)
71   checkconfig || exit 6   checkconfig || exit 6
72    
73   # masquerade and forward   # masquerade and forward
74   iptables -t nat -D POSTROUTING -s ${VMNETWORK} -o ${BRIDGEDEV} -j MASQUERADE   if systemctl --quiet is-active firewalld
75     then
76     zone="$(firewall-cmd --get-zone-of-interface ${BRIDGEDEV})"
77     firewall-cmd --quiet --zone="${zone}" --remove-masquerade
78     else
79     iptables -t nat -D POSTROUTING -s ${VMNETWORK} -o ${BRIDGEDEV} -j MASQUERADE
80     fi
81    
82   # destroy interface   # destroy interface
83   ifconfig ${TAPDEV} down   ifconfig ${TAPDEV} down

Legend:
Removed from v.2594  
changed lines
  Added in v.2595