]>
Commit | Line | Data |
---|---|---|
0ad19a3f | 1 | /* |
2 | * lxc: linux Container library | |
3 | * | |
4 | * (C) Copyright IBM Corp. 2007, 2008 | |
5 | * | |
6 | * Authors: | |
9afe19d6 | 7 | * Daniel Lezcano <daniel.lezcano at free.fr> |
0ad19a3f | 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 | |
250b1eec | 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
0ad19a3f | 22 | */ |
f1a4a029 ÇO |
23 | #ifndef __LXC_NETWORK_H |
24 | #define __LXC_NETWORK_H | |
0ad19a3f | 25 | |
0ad19a3f | 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 | */ | |
8d357196 DY |
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); | |
0ad19a3f | 36 | |
37 | /* | |
38 | * Delete a network device | |
39 | */ | |
b84f58b9 DL |
40 | extern int lxc_netdev_delete_by_name(const char *name); |
41 | extern int lxc_netdev_delete_by_index(int ifindex); | |
0ad19a3f | 42 | |
b9a5bb58 | 43 | /* |
b84f58b9 | 44 | * Change the device name |
b9a5bb58 | 45 | */ |
b84f58b9 DL |
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); | |
b9a5bb58 | 48 | |
8befa924 SH |
49 | extern int netdev_set_flag(const char *name, int flag); |
50 | ||
0ad19a3f | 51 | /* |
d472214b | 52 | * Set the device network up or down |
0ad19a3f | 53 | */ |
efa1cf45 DY |
54 | |
55 | extern int lxc_netdev_isup(const char *name); | |
d472214b DL |
56 | extern int lxc_netdev_up(const char *name); |
57 | extern int lxc_netdev_down(const char *name); | |
0ad19a3f | 58 | |
75d09f83 DL |
59 | /* |
60 | * Change the mtu size for the specified device | |
61 | */ | |
d472214b | 62 | extern int lxc_netdev_set_mtu(const char *name, int mtu); |
75d09f83 | 63 | |
0ad19a3f | 64 | /* |
d472214b | 65 | * Create a virtual network devices |
0ad19a3f | 66 | */ |
497353b6 | 67 | extern int lxc_veth_create(const char *name1, const char *name2); |
e892973e | 68 | extern int lxc_macvlan_create(const char *master, const char *name, int mode); |
7c11d57a | 69 | extern int lxc_vlan_create(const char *master, const char *name, unsigned short vid); |
26c39028 | 70 | |
0ad19a3f | 71 | /* |
72 | * Activate forwarding | |
73 | */ | |
497353b6 | 74 | extern int lxc_ip_forward_on(const char *name, int family); |
0ad19a3f | 75 | |
76 | /* | |
77 | * Disable forwarding | |
78 | */ | |
497353b6 | 79 | extern int lxc_ip_forward_off(const char *name, int family); |
0ad19a3f | 80 | |
81 | /* | |
82 | * Set ip address | |
83 | */ | |
1f1b18e7 DL |
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); | |
0ad19a3f | 90 | |
19a26f82 MK |
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 | ||
77dcf03a GL |
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 | ||
f8fee0e2 MK |
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 | ||
0ad19a3f | 109 | /* |
110 | * Attach an interface to the bridge | |
111 | */ | |
c43cbc04 | 112 | extern int lxc_bridge_attach(const char *lxcpath, const char *name, const char *bridge, const char *ifname); |
0ad19a3f | 113 | |
f79d43bb | 114 | /* |
0ad19a3f | 115 | * Create default gateway |
116 | */ | |
497353b6 DL |
117 | extern int lxc_route_create_default(const char *addr, const char *ifname, |
118 | int gateway); | |
0ad19a3f | 119 | |
120 | /* | |
121 | * Delete default gateway | |
122 | */ | |
497353b6 DL |
123 | extern int lxc_route_delete_default(const char *addr, const char *ifname, |
124 | int gateway); | |
0ad19a3f | 125 | |
126 | /* | |
127 | * Activate neighbor proxying | |
128 | */ | |
497353b6 | 129 | extern int lxc_neigh_proxy_on(const char *name, int family); |
0ad19a3f | 130 | |
131 | /* | |
132 | * Disable neighbor proxying | |
133 | */ | |
497353b6 | 134 | extern int lxc_neigh_proxy_off(const char *name, int family); |
0ad19a3f | 135 | |
a0265685 SG |
136 | /* |
137 | * Generate a new unique network interface name | |
138 | */ | |
139 | extern char *lxc_mkifname(char *template); | |
140 | ||
72d0e1cb | 141 | extern const char *lxc_net_type_to_str(int type); |
8befa924 | 142 | extern int setup_private_host_hw_addr(char *veth1); |
0130df54 | 143 | extern int netdev_get_mtu(int ifindex); |
0ad19a3f | 144 | #endif |