On Sat, Jul 05, 2014 at 04:56:16PM +0530, Ajith Adapa wrote:
> Hi,
>
> I am trying to write a sample application in C to add and delete a
> network interface into a container. My code is as shown below and it
> fails.
>
> #define DEVICE "/sys/class/net/eth2"
> #define NAME "eth1"
>
> if (!c->add_device_node(c, DEVICE, NAME)) {
> fprintf(stderr, "Adding %s to the container (%s) failed...\n",
> DEVICE, NAME);
> goto out;
> }
>
> Is there anything wrong in the way I am using the add API ?Yes, network interfaces are special, they aren't character or block devices, they just are network interfaces so that won't work with add_device_node. The python3 module does support it (which is why lxc-device supports it too) by using the namespace capabilities of the ip command. It'd probably be nice to re-implement that in C with netlink as add_interface and remove_interface so that it's available to all API users (patches are welcome!). > > Regards, > Ajith > _______________________________________________ > lxc-devel mailing list > [email protected] > http://lists.linuxcontainers.org/listinfo/lxc-devel -- Stéphane Graber Ubuntu developer http://www.ubuntu.com
signature.asc
Description: Digital signature
_______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
