]> git.proxmox.com Git - mirror_lxc.git/blob - src/lxc/network.h
Merge pull request #1539 from brauner/2017-05-06/fix_abstract_unix_sockets
[mirror_lxc.git] / src / lxc / network.h
1 /*
2 * lxc: linux Container library
3 *
4 * (C) Copyright IBM Corp. 2007, 2008
5 *
6 * Authors:
7 * Daniel Lezcano <daniel.lezcano at free.fr>
8 *
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.
13 *
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.
18 *
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23 #ifndef __LXC_NETWORK_H
24 #define __LXC_NETWORK_H
25
26 /*
27 * Convert a string mac address to a socket structure
28 */
29 extern int lxc_convert_mac(char *macaddr, struct sockaddr *sockaddr);
30
31 /*
32 * Move a device between namespaces
33 */
34 extern int lxc_netdev_move_by_index(int ifindex, pid_t pid, const char* ifname);
35 extern int lxc_netdev_move_by_name(const char *ifname, pid_t pid, const char* newname);
36
37 /*
38 * Delete a network device
39 */
40 extern int lxc_netdev_delete_by_name(const char *name);
41 extern int lxc_netdev_delete_by_index(int ifindex);
42
43 /*
44 * Change the device name
45 */
46 extern int lxc_netdev_rename_by_name(const char *oldname, const char *newname);
47 extern int lxc_netdev_rename_by_index(int ifindex, const char *newname);
48
49 extern int netdev_set_flag(const char *name, int flag);
50
51 /*
52 * Set the device network up or down
53 */
54
55 extern int lxc_netdev_isup(const char *name);
56 extern int lxc_netdev_up(const char *name);
57 extern int lxc_netdev_down(const char *name);
58
59 /*
60 * Change the mtu size for the specified device
61 */
62 extern int lxc_netdev_set_mtu(const char *name, int mtu);
63
64 /*
65 * Create a virtual network devices
66 */
67 extern int lxc_veth_create(const char *name1, const char *name2);
68 extern int lxc_macvlan_create(const char *master, const char *name, int mode);
69 extern int lxc_vlan_create(const char *master, const char *name, unsigned short vid);
70
71 /*
72 * Activate forwarding
73 */
74 extern int lxc_ip_forward_on(const char *name, int family);
75
76 /*
77 * Disable forwarding
78 */
79 extern int lxc_ip_forward_off(const char *name, int family);
80
81 /*
82 * Set ip address
83 */
84 extern int lxc_ipv6_addr_add(int ifindex, struct in6_addr *addr,
85 struct in6_addr *mcast,
86 struct in6_addr *acast, int prefix);
87
88 extern int lxc_ipv4_addr_add(int ifindex, struct in_addr *addr,
89 struct in_addr *bcast, int prefix);
90
91 /*
92 * Get ip address
93 */
94 extern int lxc_ipv4_addr_get(int ifindex, struct in_addr **res);
95 extern int lxc_ipv6_addr_get(int ifindex, struct in6_addr **res);
96
97 /*
98 * Set a destination route to an interface
99 */
100 extern int lxc_ipv4_dest_add(int ifindex, struct in_addr *dest);
101 extern int lxc_ipv6_dest_add(int ifindex, struct in6_addr *dest);
102
103 /*
104 * Set default route.
105 */
106 extern int lxc_ipv4_gateway_add(int ifindex, struct in_addr *gw);
107 extern int lxc_ipv6_gateway_add(int ifindex, struct in6_addr *gw);
108
109 /*
110 * Attach an interface to the bridge
111 */
112 extern int lxc_bridge_attach(const char *lxcpath, const char *name, const char *bridge, const char *ifname);
113
114 /*
115 * Create default gateway
116 */
117 extern int lxc_route_create_default(const char *addr, const char *ifname,
118 int gateway);
119
120 /*
121 * Delete default gateway
122 */
123 extern int lxc_route_delete_default(const char *addr, const char *ifname,
124 int gateway);
125
126 /*
127 * Activate neighbor proxying
128 */
129 extern int lxc_neigh_proxy_on(const char *name, int family);
130
131 /*
132 * Disable neighbor proxying
133 */
134 extern int lxc_neigh_proxy_off(const char *name, int family);
135
136 /*
137 * Generate a new unique network interface name
138 */
139 extern char *lxc_mkifname(char *template);
140
141 extern const char *lxc_net_type_to_str(int type);
142 extern int setup_private_host_hw_addr(char *veth1);
143 extern int netdev_get_mtu(int ifindex);
144 #endif