~ubuntu-branches/ubuntu/quantal/lxc/quantal-201208301614

« back to all changes in this revision

Viewing changes to test/conf.c

  • Committer: Bazaar Package Importer
  • Author(s): Guido Trotter, Stéphane Graber, Guido Trotter
  • Date: 2010-01-10 10:40:21 UTC
  • mfrom: (1.2.2 upstream)
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: james.westby@ubuntu.com-20100110104021-25cm8w09ccmw5w2z
[ Stéphane Graber ]
* Upgrade standards-version to 3.8.3
* Drop the copy of etc/* from rules as "etc" is no longer in the tarball

[ Guido Trotter ]
* New Upstream Version
* Update libcap2-dev dependency to libcap-dev
* Install upstream-built man pages via debian/lxc.manpages
* Drop unneeded docbook-utils build dependency

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * lxc: linux Container library
3
 
 *
4
 
 * (C) Copyright IBM Corp. 2007, 2008
5
 
 *
6
 
 * Authors:
7
 
 * Daniel Lezcano <dlezcano at fr.ibm.com>
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
 
 */
23
 
#include <stdio.h>
24
 
#include <errno.h>
25
 
#include <sys/types.h>
26
 
#include <sys/utsname.h>
27
 
#include <netinet/in.h>
28
 
#include <net/if.h>
29
 
 
30
 
#include <lxc/list.h>
31
 
#include <lxc/conf.h>
32
 
 
33
 
/*
34
 
 * I want to setup a container with a veth attached on a bridge, 
35
 
 * and have them up
36
 
 */
37
 
 
38
 
int main(int argc, char *argv[])
39
 
{
40
 
/*      struct network network = { */
41
 
/*              .net = init_list(&network.net), */
42
 
/*              .netdev = init_list(&network.netdev), */
43
 
/*      }; */
44
 
 
45
 
/*      struct veth veth = { */
46
 
/*              .link = "veth1", */
47
 
/*              .peer = "veth2", */
48
 
/*              .bridge = "br0", */
49
 
/*      }; */
50
 
 
51
 
/*      struct net net = { */
52
 
/*              .type = VETH, */
53
 
/*      }; */
54
 
 
55
 
/*      net.veth = veth; */
56
 
 
57
 
/*      struct netdev lo = { */
58
 
/*              .ifname = "lo", */
59
 
/*              .flags = IFF_UP, */
60
 
/*              .ipv4 = init_list(&lo.ipv4), */
61
 
/*              .ipv6 = init_list(&lo.ipv6), */
62
 
/*      }; */
63
 
 
64
 
/*      struct netdev veth1 = { */
65
 
/*              .ifname = "veth1", */
66
 
/*              .flags = IFF_UP, */
67
 
/*              .ipv4 = init_list(&veth1.ipv4), */
68
 
/*              .ipv6 = init_list(&veth1.ipv6), */
69
 
/*      }; */
70
 
 
71
 
/*      struct netdev veth2 = { */
72
 
/*              .ifname = "veth2", */
73
 
/*              .flags = IFF_UP, */
74
 
/*              .netns = 1, */
75
 
/*              .ipv4 = init_list(&veth2.ipv4), */
76
 
/*              .ipv6 = init_list(&veth2.ipv6), */
77
 
/*      }; */
78
 
        
79
 
/*      struct netdev br0 = { */
80
 
/*              .ifname = "br0", */
81
 
/*              .ipv4 = init_list(&br0.ipv4), */
82
 
/*              .ipv6 = init_list(&br0.ipv6), */
83
 
/*      }; */
84
 
 
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); */
90
 
        
91
 
/*      struct lxc_conf lxc_conf = { */
92
 
/*              .network = &network, */
93
 
/*              .mounts = init_list(&lxc_conf.mounts), */
94
 
/*      }; */
95
 
 
96
 
/*      if (lxc_configure("foo", &lxc_conf)) { */
97
 
/*              fprintf(stderr, "failed to configure\n"); */
98
 
/*              return 1; */
99
 
/*      } */
100
 
 
101
 
        return 0;
102
 
}