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
25
#include <sys/types.h>
26
#include <sys/utsname.h>
27
#include <netinet/in.h>
34
* I want to setup a container with a veth attached on a bridge,
38
int main(int argc, char *argv[])
40
/* struct network network = { */
41
/* .net = init_list(&network.net), */
42
/* .netdev = init_list(&network.netdev), */
45
/* struct veth veth = { */
46
/* .link = "veth1", */
47
/* .peer = "veth2", */
48
/* .bridge = "br0", */
51
/* struct net net = { */
55
/* net.veth = veth; */
57
/* struct netdev lo = { */
59
/* .flags = IFF_UP, */
60
/* .ipv4 = init_list(&lo.ipv4), */
61
/* .ipv6 = init_list(&lo.ipv6), */
64
/* struct netdev veth1 = { */
65
/* .ifname = "veth1", */
66
/* .flags = IFF_UP, */
67
/* .ipv4 = init_list(&veth1.ipv4), */
68
/* .ipv6 = init_list(&veth1.ipv6), */
71
/* struct netdev veth2 = { */
72
/* .ifname = "veth2", */
73
/* .flags = IFF_UP, */
75
/* .ipv4 = init_list(&veth2.ipv4), */
76
/* .ipv6 = init_list(&veth2.ipv6), */
79
/* struct netdev br0 = { */
80
/* .ifname = "br0", */
81
/* .ipv4 = init_list(&br0.ipv4), */
82
/* .ipv6 = init_list(&br0.ipv6), */
85
/* list_add(&network.netdev, &lo.list); */
86
/* list_add(&network.netdev, &veth1.list); */
87
/* list_add(&network.netdev, &veth2.list); */
88
/* list_add(&network.netdev, &br0.list); */
89
/* list_add(&network.net, &net.list); */
91
/* struct lxc_conf lxc_conf = { */
92
/* .network = &network, */
93
/* .mounts = init_list(&lxc_conf.mounts), */
96
/* if (lxc_configure("foo", &lxc_conf)) { */
97
/* fprintf(stderr, "failed to configure\n"); */