2007-02-14 16:26:42 +00:00
|
|
|
/*
|
2012-12-12 17:42:44 +00:00
|
|
|
* viriptables.h: helper APIs for managing iptables
|
|
|
|
*
|
2008-11-07 16:43:23 +00:00
|
|
|
* Copyright (C) 2007, 2008 Red Hat, Inc.
|
2007-02-14 16:26:42 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2012-09-20 22:30:55 +00:00
|
|
|
* License along with this library. If not, see
|
2012-07-21 10:06:23 +00:00
|
|
|
* <http://www.gnu.org/licenses/>.
|
2007-02-14 16:26:42 +00:00
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Mark McLoughlin <markmc@redhat.com>
|
|
|
|
*/
|
|
|
|
|
2014-03-06 17:01:13 +00:00
|
|
|
#ifndef __VIR_IPTABLES_H__
|
|
|
|
# define __VIR_IPTABLES_H__
|
2007-02-14 16:26:42 +00:00
|
|
|
|
Split src/util/network.{c,h} into 5 pieces
The src/util/network.c file is a dumping ground for many different
APIs. Split it up into 5 pieces, along functional lines
- src/util/virnetdevbandwidth.c: virNetDevBandwidth type & helper APIs
- src/util/virnetdevvportprofile.c: virNetDevVPortProfile type & helper APIs
- src/util/virsocketaddr.c: virSocketAddr and APIs
- src/conf/netdev_bandwidth_conf.c: XML parsing / formatting
for virNetDevBandwidth
- src/conf/netdev_vport_profile_conf.c: XML parsing / formatting
for virNetDevVPortProfile
* src/util/network.c, src/util/network.h: Split into 5 pieces
* src/conf/netdev_bandwidth_conf.c, src/conf/netdev_bandwidth_conf.h,
src/conf/netdev_vport_profile_conf.c, src/conf/netdev_vport_profile_conf.h,
src/util/virnetdevbandwidth.c, src/util/virnetdevbandwidth.h,
src/util/virnetdevvportprofile.c, src/util/virnetdevvportprofile.h,
src/util/virsocketaddr.c, src/util/virsocketaddr.h: New pieces
* daemon/libvirtd.h, daemon/remote.c, src/conf/domain_conf.c,
src/conf/domain_conf.h, src/conf/network_conf.c,
src/conf/network_conf.h, src/conf/nwfilter_conf.h,
src/esx/esx_util.h, src/network/bridge_driver.c,
src/qemu/qemu_conf.c, src/rpc/virnetsocket.c,
src/rpc/virnetsocket.h, src/util/dnsmasq.h, src/util/interface.h,
src/util/iptables.h, src/util/macvtap.c, src/util/macvtap.h,
src/util/virnetdev.h, src/util/virnetdevtap.c,
tools/virsh.c: Update include files
2011-11-02 15:40:08 +00:00
|
|
|
# include "virsocketaddr.h"
|
2014-03-06 17:01:13 +00:00
|
|
|
# include "virfirewall.h"
|
Convert virNetwork to use virSocketAddr everywhere
Instead of storing the IP address string in virNetwork related
structs, store the parsed virSocketAddr. This will make it
easier to add IPv6 support in the future, by letting driver
code directly check what address family is present
* src/conf/network_conf.c, src/conf/network_conf.h,
src/network/bridge_driver.c: Convert to use virSocketAddr
in virNetwork, instead of char *.
* src/util/bridge.c, src/util/bridge.h,
src/util/dnsmasq.c, src/util/dnsmasq.h,
src/util/iptables.c, src/util/iptables.h: Convert to
take a virSocketAddr instead of char * for any IP
address parameters
* src/util/network.h: Add macros to determine if an address
is set, and what address family is set.
2010-10-21 12:14:33 +00:00
|
|
|
|
2014-03-06 17:01:13 +00:00
|
|
|
void iptablesAddTcpInput (virFirewallPtr fw,
|
|
|
|
virFirewallLayer layer,
|
2007-02-14 16:26:42 +00:00
|
|
|
const char *iface,
|
|
|
|
int port);
|
2014-03-06 17:01:13 +00:00
|
|
|
void iptablesRemoveTcpInput (virFirewallPtr fw,
|
|
|
|
virFirewallLayer layer,
|
2007-02-14 16:26:42 +00:00
|
|
|
const char *iface,
|
|
|
|
int port);
|
|
|
|
|
2014-03-06 17:01:13 +00:00
|
|
|
void iptablesAddUdpInput (virFirewallPtr fw,
|
|
|
|
virFirewallLayer layer,
|
2007-02-14 16:26:42 +00:00
|
|
|
const char *iface,
|
|
|
|
int port);
|
2014-03-06 17:01:13 +00:00
|
|
|
void iptablesRemoveUdpInput (virFirewallPtr fw,
|
|
|
|
virFirewallLayer layer,
|
2007-02-14 16:26:42 +00:00
|
|
|
const char *iface,
|
|
|
|
int port);
|
|
|
|
|
2014-03-06 17:01:13 +00:00
|
|
|
void iptablesAddUdpOutput (virFirewallPtr fw,
|
|
|
|
virFirewallLayer layer,
|
2013-12-17 17:56:28 +00:00
|
|
|
const char *iface,
|
|
|
|
int port);
|
2014-03-06 17:01:13 +00:00
|
|
|
void iptablesRemoveUdpOutput (virFirewallPtr fw,
|
|
|
|
virFirewallLayer layer,
|
2013-12-17 17:56:28 +00:00
|
|
|
const char *iface,
|
|
|
|
int port);
|
|
|
|
|
2014-03-06 17:01:13 +00:00
|
|
|
int iptablesAddForwardAllowOut (virFirewallPtr fw,
|
|
|
|
virSocketAddr *netaddr,
|
2010-11-30 19:35:58 +00:00
|
|
|
unsigned int prefix,
|
2007-03-13 22:43:22 +00:00
|
|
|
const char *iface,
|
2014-03-06 17:01:13 +00:00
|
|
|
const char *physdev)
|
|
|
|
ATTRIBUTE_RETURN_CHECK;
|
|
|
|
int iptablesRemoveForwardAllowOut (virFirewallPtr fw,
|
|
|
|
virSocketAddr *netaddr,
|
2010-11-30 19:35:58 +00:00
|
|
|
unsigned int prefix,
|
2007-03-13 22:43:22 +00:00
|
|
|
const char *iface,
|
2014-03-06 17:01:13 +00:00
|
|
|
const char *physdev)
|
|
|
|
ATTRIBUTE_RETURN_CHECK;
|
|
|
|
int iptablesAddForwardAllowRelatedIn(virFirewallPtr fw,
|
|
|
|
virSocketAddr *netaddr,
|
2010-11-30 19:35:58 +00:00
|
|
|
unsigned int prefix,
|
2008-03-28 20:38:21 +00:00
|
|
|
const char *iface,
|
2014-03-06 17:01:13 +00:00
|
|
|
const char *physdev)
|
|
|
|
ATTRIBUTE_RETURN_CHECK;
|
|
|
|
int iptablesRemoveForwardAllowRelatedIn(virFirewallPtr fw,
|
|
|
|
virSocketAddr *netaddr,
|
|
|
|
unsigned int prefix,
|
|
|
|
const char *iface,
|
|
|
|
const char *physdev)
|
|
|
|
ATTRIBUTE_RETURN_CHECK;
|
2007-02-14 16:26:42 +00:00
|
|
|
|
2014-03-06 17:01:13 +00:00
|
|
|
int iptablesAddForwardAllowIn (virFirewallPtr fw,
|
|
|
|
virSocketAddr *netaddr,
|
2010-11-30 19:35:58 +00:00
|
|
|
unsigned int prefix,
|
2007-03-13 22:43:22 +00:00
|
|
|
const char *iface,
|
2014-03-06 17:01:13 +00:00
|
|
|
const char *physdev)
|
|
|
|
ATTRIBUTE_RETURN_CHECK;
|
|
|
|
int iptablesRemoveForwardAllowIn (virFirewallPtr fw,
|
|
|
|
virSocketAddr *netaddr,
|
2010-11-30 19:35:58 +00:00
|
|
|
unsigned int prefix,
|
2007-03-13 22:43:22 +00:00
|
|
|
const char *iface,
|
2014-03-06 17:01:13 +00:00
|
|
|
const char *physdev)
|
|
|
|
ATTRIBUTE_RETURN_CHECK;
|
2007-04-10 23:17:46 +00:00
|
|
|
|
2014-03-06 17:01:13 +00:00
|
|
|
void iptablesAddForwardAllowCross (virFirewallPtr fw,
|
|
|
|
virFirewallLayer layer,
|
2007-04-10 23:17:46 +00:00
|
|
|
const char *iface);
|
2014-03-06 17:01:13 +00:00
|
|
|
void iptablesRemoveForwardAllowCross (virFirewallPtr fw,
|
|
|
|
virFirewallLayer layer,
|
2007-04-10 23:17:46 +00:00
|
|
|
const char *iface);
|
|
|
|
|
2014-03-06 17:01:13 +00:00
|
|
|
void iptablesAddForwardRejectOut (virFirewallPtr fw,
|
|
|
|
virFirewallLayer layer,
|
2007-04-10 23:17:46 +00:00
|
|
|
const char *iface);
|
2014-03-06 17:01:13 +00:00
|
|
|
void iptablesRemoveForwardRejectOut (virFirewallPtr fw,
|
|
|
|
virFirewallLayer layer,
|
2007-04-10 23:17:46 +00:00
|
|
|
const char *iface);
|
|
|
|
|
2014-03-06 17:01:13 +00:00
|
|
|
void iptablesAddForwardRejectIn (virFirewallPtr fw,
|
|
|
|
virFirewallLayer layer,
|
2007-04-10 23:17:46 +00:00
|
|
|
const char *iface);
|
2014-03-06 17:01:13 +00:00
|
|
|
void iptablesRemoveForwardRejectIn (virFirewallPtr fw,
|
|
|
|
virFirewallLayer layery,
|
2007-04-10 23:17:46 +00:00
|
|
|
const char *iface);
|
2007-02-14 16:26:42 +00:00
|
|
|
|
2014-03-06 17:01:13 +00:00
|
|
|
int iptablesAddForwardMasquerade (virFirewallPtr fw,
|
|
|
|
virSocketAddr *netaddr,
|
2010-11-30 19:35:58 +00:00
|
|
|
unsigned int prefix,
|
2010-06-10 16:50:38 +00:00
|
|
|
const char *physdev,
|
2013-02-19 10:44:16 +00:00
|
|
|
virSocketAddrRangePtr addr,
|
|
|
|
virPortRangePtr port,
|
2014-03-06 17:01:13 +00:00
|
|
|
const char *protocol)
|
|
|
|
ATTRIBUTE_RETURN_CHECK;
|
|
|
|
int iptablesRemoveForwardMasquerade (virFirewallPtr fw,
|
|
|
|
virSocketAddr *netaddr,
|
2010-11-30 19:35:58 +00:00
|
|
|
unsigned int prefix,
|
2010-06-10 16:50:38 +00:00
|
|
|
const char *physdev,
|
2013-02-19 10:44:16 +00:00
|
|
|
virSocketAddrRangePtr addr,
|
|
|
|
virPortRangePtr port,
|
2014-03-06 17:01:13 +00:00
|
|
|
const char *protocol)
|
|
|
|
ATTRIBUTE_RETURN_CHECK;
|
|
|
|
int iptablesAddDontMasquerade (virFirewallPtr fw,
|
|
|
|
virSocketAddr *netaddr,
|
2013-09-25 10:45:25 +00:00
|
|
|
unsigned int prefix,
|
|
|
|
const char *physdev,
|
2014-03-06 17:01:13 +00:00
|
|
|
const char *destaddr)
|
|
|
|
ATTRIBUTE_RETURN_CHECK;
|
|
|
|
int iptablesRemoveDontMasquerade (virFirewallPtr fw,
|
|
|
|
virSocketAddr *netaddr,
|
2013-09-25 10:45:25 +00:00
|
|
|
unsigned int prefix,
|
|
|
|
const char *physdev,
|
2014-03-06 17:01:13 +00:00
|
|
|
const char *destaddr)
|
|
|
|
ATTRIBUTE_RETURN_CHECK;
|
|
|
|
void iptablesAddOutputFixUdpChecksum (virFirewallPtr fw,
|
|
|
|
const char *iface,
|
2010-07-13 02:59:58 +00:00
|
|
|
int port);
|
2014-03-06 17:01:13 +00:00
|
|
|
void iptablesRemoveOutputFixUdpChecksum (virFirewallPtr fw,
|
|
|
|
const char *iface,
|
2010-07-13 02:59:58 +00:00
|
|
|
int port);
|
2007-02-14 16:26:42 +00:00
|
|
|
|
2014-03-06 17:01:13 +00:00
|
|
|
#endif /* __VIR_IPTABLES_H__ */
|