[lxc-devel] [lxc/lxc] 599781: network: convert param ifname to const.

GitHub noreply at github.com
Wed Oct 15 21:40:54 UTC 2014


  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: 599781664bdd7adde21291d5581cc26c5769c3d0
      https://github.com/lxc/lxc/commit/599781664bdd7adde21291d5581cc26c5769c3d0
  Author: Dongsheng Yang <yangds.fnst at cn.fujitsu.com>
  Date:   2014-10-15 (Wed, 15 Oct 2014)

  Changed paths:
    M src/lxc/network.c
    M src/lxc/network.h

  Log Message:
  -----------
  network: convert param ifname to const.

We should not modify ifname in lxc_netdev_move_by_name(),
making it as const in param list will make our code more
robust.

Signed-off-by: Dongsheng Yang <yangds.fnst at cn.fujitsu.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>


  Commit: 49428bf306f5d2e79e6030a62373a83ffbce0dea
      https://github.com/lxc/lxc/commit/49428bf306f5d2e79e6030a62373a83ffbce0dea
  Author: Dongsheng Yang <yangds.fnst at cn.fujitsu.com>
  Date:   2014-10-15 (Wed, 15 Oct 2014)

  Changed paths:
    M src/lxc/network.c

  Log Message:
  -----------
  network: check result of if_nametoindex().

When we want to get index of a ifname which does not
exist, we should return a -EINVAL in this case.

Signed-off-by: Dongsheng Yang <yangds.fnst at cn.fujitsu.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>


  Commit: 312f9c5dfe165b2831a5ef9d085994e75fb6e7ac
      https://github.com/lxc/lxc/commit/312f9c5dfe165b2831a5ef9d085994e75fb6e7ac
  Author: Dongsheng Yang <yangds.fnst at cn.fujitsu.com>
  Date:   2014-10-15 (Wed, 15 Oct 2014)

  Changed paths:
    M src/lxc/lxc_start.c

  Log Message:
  -----------
  lxc_start: ERROR if container is already running.

We should exit with a error when starting a running container.

Signed-off-by: Dongsheng Yang <yangds.fnst at cn.fujitsu.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>


  Commit: 8d357196c4bebe2e77bfa545336dc24bd7b9039d
      https://github.com/lxc/lxc/commit/8d357196c4bebe2e77bfa545336dc24bd7b9039d
  Author: Dongsheng Yang <yangds.fnst at cn.fujitsu.com>
  Date:   2014-10-15 (Wed, 15 Oct 2014)

  Changed paths:
    M src/lxc/conf.c
    M src/lxc/lxc_unshare.c
    M src/lxc/lxc_user_nic.c
    M src/lxc/network.c
    M src/lxc/network.h

  Log Message:
  -----------
  network: allow lxc_network_move_by_index() rename netdev in moving.

In netlink, we can set the dest_name of netdev when move netdev
between namespaces in one netlink request. And moving a netdev of
a src_name to a netdev with a dest_name is a common usecase.

So this patch add a parametaer to lxc_network_move_by_index() to
indicate the dest_name for the movement. NULL means same with
the src_name.

Signed-off-by: Dongsheng Yang <yangds.fnst at cn.fujitsu.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>


  Commit: efa1cf45a23c450b4566705f2fe46fc22a0a6482
      https://github.com/lxc/lxc/commit/efa1cf45a23c450b4566705f2fe46fc22a0a6482
  Author: Dongsheng Yang <yangds.fnst at cn.fujitsu.com>
  Date:   2014-10-15 (Wed, 15 Oct 2014)

  Changed paths:
    M src/lxc/network.c
    M src/lxc/network.h

  Log Message:
  -----------
  network: introduce a interface named lxc_netdev_isup().

When we need to know some info about a netdev, such as is_up or not,
we need to read the flag for the netdev.

This patch introduce a interface function named lxc_netdev_isup()
to check is a netdev up or down.

And introduce a network private function named netdev_get_flag()
to get flag for netdev by netlink.

Changelog: 10/15/2015: Return failure if name==NULL to avoid later strlen fun

Signed-off-by: Dongsheng Yang <yangds.fnst at cn.fujitsu.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>


  Commit: 51d0854cd6360b953c37e3bf1b9a85ce031b2075
      https://github.com/lxc/lxc/commit/51d0854cd6360b953c37e3bf1b9a85ce031b2075
  Author: Dongsheng Yang <yangds.fnst at cn.fujitsu.com>
  Date:   2014-10-15 (Wed, 15 Oct 2014)

  Changed paths:
    M src/lxc/lxccontainer.c
    M src/lxc/lxccontainer.h
    M src/lxc/utils.c
    M src/lxc/utils.h

  Log Message:
  -----------
  utils: move useful helper functions from lxccontainer to utils.

Function of enter_to_ns() is useful but currently is static for
lxccontainer.c.

This patch split it into two parts named as switch_to_newuser()
and switch_to_newnet() into utils.c.

Signed-off-by: Dongsheng Yang <yangds.fnst at cn.fujitsu.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>


  Commit: e58fae8f29b171bb0fd164c2f566b2475a2b6928
      https://github.com/lxc/lxc/commit/e58fae8f29b171bb0fd164c2f566b2475a2b6928
  Author: Dongsheng Yang <yangds.fnst at cn.fujitsu.com>
  Date:   2014-10-15 (Wed, 15 Oct 2014)

  Changed paths:
    M src/lxc/lxccontainer.c

  Log Message:
  -----------
  container: introduce two functions named as {at/de}tach_interface().

Currently, we depends on ip command to attach interface to container.
It means we only implemented it by python.

This patch implement adding and removing interface by c and added
them in struct container.

Changelog: 10/15/2014 (serge): return error if ifname is NULL.

Signed-off-by: Dongsheng Yang <yangds.fnst at cn.fujitsu.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>


  Commit: cbf535294c0c170832ba697edee90420a8c8c67b
      https://github.com/lxc/lxc/commit/cbf535294c0c170832ba697edee90420a8c8c67b
  Author: Dongsheng Yang <yangds.fnst at cn.fujitsu.com>
  Date:   2014-10-15 (Wed, 15 Oct 2014)

  Changed paths:
    M src/python-lxc/lxc.c

  Log Message:
  -----------
  python-lxc: Add [at|de]tach_interface() to python binding.

Changelog: 10/15/2014: serge: make ifname mandatory for detach_interface.

Signed-off-by: Dongsheng Yang <yangds.fnst at cn.fujitsu.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>


  Commit: ea467969450684c268a5a3abff36b8ec36557080
      https://github.com/lxc/lxc/commit/ea467969450684c268a5a3abff36b8ec36557080
  Author: Dongsheng Yang <yangds.fnst at cn.fujitsu.com>
  Date:   2014-10-15 (Wed, 15 Oct 2014)

  Changed paths:
    M src/lxc/Makefile.am
    R src/lxc/lxc-device
    A src/lxc/lxc_device.c

  Log Message:
  -----------
  lxc-device: rewrite lxc-device.

As there is a function named attach_interface to pass
a interface to container now, we do not need to relay on
python impolementation for lxc-device any more.

changelog: 10/15/2014: serge: fail immediately if run as non-root.
changelog: 10/15/2014: serge: add explicit error message on bad usage (fix build failure)

Signed-off-by: Dongsheng Yang <yangds.fnst at cn.fujitsu.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>


  Commit: e0f591898458167ac110aab5b4cabb892e673083
      https://github.com/lxc/lxc/commit/e0f591898458167ac110aab5b4cabb892e673083
  Author: Serge Hallyn <serge.hallyn at ubuntu.com>
  Date:   2014-10-15 (Wed, 15 Oct 2014)

  Changed paths:
    M src/lxc/lxccontainer.c

  Log Message:
  -----------
  lxccontainer.c: rename enter_to_ns to enter_net_ns

because that's what it does

Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>


  Commit: e5848d395cb4d1c09ec27457a63b56c1f1f88408
      https://github.com/lxc/lxc/commit/e5848d395cb4d1c09ec27457a63b56c1f1f88408
  Author: Serge Hallyn <serge.hallyn at ubuntu.com>
  Date:   2014-10-15 (Wed, 15 Oct 2014)

  Changed paths:
    M src/lxc/lxccontainer.c
    M src/lxc/network.c

  Log Message:
  -----------
  netdev_move_by_index: support wlan

The python lxc-device supported adding wlan devices, so add that
support as well.  Since the python one did not support 'del',
I didn't try adding that support, though it should be trivial to
add.

We should be able to do the wlan adding using netlink, but I
went ahead and used 'iw' as the netlink path looked more
complicated than it does for other nics.  Patches to switch that
over would be very welcome.

Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>


Compare: https://github.com/lxc/lxc/compare/ecec0126b595...e5848d395cb4


More information about the lxc-devel mailing list