]> git.ipfire.org Git - thirdparty/lxc.git/commit
confile_legacy: fix lxc_clear_nic error 1649/head
author0x0916 <w@laoqinren.net>
Thu, 29 Jun 2017 03:48:35 +0000 (11:48 +0800)
committer0x0916 <w@laoqinren.net>
Thu, 29 Jun 2017 05:32:16 +0000 (13:32 +0800)
commitc2dbbbb6122e1ed1814dc076e4300d30ad3759e7
treea5d49a472b2f968df88cf3a7c1fa44b2c1d81758
parent935cfd3e36f0d4dbabd72b58ab63ff4ced294a23
confile_legacy: fix lxc_clear_nic error

`lxc_clear_nic` can not clear the nic, because it will not found
the right `netdev`.

testcase from get_item.c

```
313         if (!c->set_config_item(c, "lxc.network.hwaddr", "00:16:3e:xx:xx:xx")) {
314                 fprintf(stderr, "%d: failed to set network.hwaddr\n", __LINE__);
315                 goto out;
316         }
317         if (!c->set_config_item(c, "lxc.network.ipv4", "10.2.3.4")) {
318                 fprintf(stderr, "%d: failed to set ipv4\n", __LINE__);
319                 goto out;
320         }
321
322         ret = c->get_config_item(c, "lxc.network.0.ipv4", v2, 255);
323         if (ret <= 0) {
324                 fprintf(stderr, "%d: lxc.network.0.ipv4 returned %d\n", __LINE__, ret);
325                 goto out;
326         }
327         if (!c->clear_config_item(c, "lxc.network.0.ipv4")) {
328                 fprintf(stderr, "%d: failed clearing all ipv4 entries\n", __LINE__);
329                 goto out;
330         }
331         ret = c->get_config_item(c, "lxc.network.0.ipv4", v2, 255);
332         if (ret != 0) {
333                 fprintf(stderr, "%d: after clearing ipv4 entries get_item(lxc.network.0.ipv4 returned %d\n", __LINE__, ret);
334                 goto out;
335         }
```

line `327` will failed to clear nic, and line `333` give the error.

Signed-off-by: 0x0916 <w@laoqinren.net>
src/lxc/confile_legacy.c