]>
git.proxmox.com Git - mirror_lxc.git/blob - src/lxc/network.h
2 * lxc: linux Container library
4 * (C) Copyright IBM Corp. 2007, 2008
7 * Daniel Lezcano <dlezcano at fr.ibm.com>
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 * Convert a string mac address to a socket structure
29 extern int lxc_convert_mac(char *macaddr
, struct sockaddr
*sockaddr
);
32 * Move a device between namespaces
34 extern int lxc_netdev_move_by_index(int ifindex
, pid_t pid
);
37 * Delete a network device
39 extern int lxc_netdev_delete_by_name(const char *name
);
40 extern int lxc_netdev_delete_by_index(int ifindex
);
43 * Change the device name
45 extern int lxc_netdev_rename_by_name(const char *oldname
, const char *newname
);
46 extern int lxc_netdev_rename_by_index(int ifindex
, const char *newname
);
49 * Set the device network up or down
51 extern int lxc_netdev_up(const char *name
);
52 extern int lxc_netdev_down(const char *name
);
55 * Change the mtu size for the specified device
57 extern int lxc_netdev_set_mtu(const char *name
, int mtu
);
60 * Create a virtual network devices
62 extern int lxc_veth_create(const char *name1
, const char *name2
);
63 extern int lxc_macvlan_create(const char *master
, const char *name
, int mode
);
64 extern int lxc_vlan_create(const char *master
, const char *name
, ushort vid
);
69 extern int lxc_ip_forward_on(const char *name
, int family
);
74 extern int lxc_ip_forward_off(const char *name
, int family
);
79 extern int lxc_ipv6_addr_add(int ifindex
, struct in6_addr
*addr
,
80 struct in6_addr
*mcast
,
81 struct in6_addr
*acast
, int prefix
);
83 extern int lxc_ipv4_addr_add(int ifindex
, struct in_addr
*addr
,
84 struct in_addr
*bcast
, int prefix
);
89 extern int lxc_ipv4_addr_get(int ifindex
, struct in_addr
**res
);
90 extern int lxc_ipv6_addr_get(int ifindex
, struct in6_addr
**res
);
95 extern int lxc_ipv4_gateway_add(int ifindex
, struct in_addr
*gw
);
96 extern int lxc_ipv6_gateway_add(int ifindex
, struct in6_addr
*gw
);
99 * Attach an interface to the bridge
101 extern int lxc_bridge_attach(const char *bridge
, const char *ifname
);
104 * Create default gateway
106 extern int lxc_route_create_default(const char *addr
, const char *ifname
,
110 * Delete default gateway
112 extern int lxc_route_delete_default(const char *addr
, const char *ifname
,
116 * Activate neighbor proxying
118 extern int lxc_neigh_proxy_on(const char *name
, int family
);
121 * Disable neighbor proxying
123 extern int lxc_neigh_proxy_off(const char *name
, int family
);
125 extern const char *lxc_net_type_to_str(int type
);