diff options
Diffstat (limited to 'recipes-containers/lxc/files/lxc-let-lxc-start-support-wlan-phys.patch')
-rw-r--r-- | recipes-containers/lxc/files/lxc-let-lxc-start-support-wlan-phys.patch | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/recipes-containers/lxc/files/lxc-let-lxc-start-support-wlan-phys.patch b/recipes-containers/lxc/files/lxc-let-lxc-start-support-wlan-phys.patch new file mode 100644 index 00000000..9146fd07 --- /dev/null +++ b/recipes-containers/lxc/files/lxc-let-lxc-start-support-wlan-phys.patch | |||
@@ -0,0 +1,72 @@ | |||
1 | From 4acc7a24e098445de502a6f59a8b3dff2cd8536d Mon Sep 17 00:00:00 2001 | ||
2 | From: fli <fupan.li@windriver.com> | ||
3 | Date: Thu, 21 Apr 2016 19:07:10 -0700 | ||
4 | Subject: [PATCH] lxc: let lxc-start support wlan phys | ||
5 | |||
6 | The commit: e5848d395cb <netdev_move_by_index: support wlan> only | ||
7 | made netdev_move_by_name support wlan, instead of netdev_move_by_index. | ||
8 | |||
9 | Given netdev_move_by_name is a wrapper of netdev_move_by_index, so here | ||
10 | replacing all of the call to lxc_netdev_move_by_index with lxc_netdev_move_by_name | ||
11 | to let lxc-start support wlan phys. | ||
12 | |||
13 | Signed-off-by: fli <fupan.li@windriver.com> | ||
14 | --- | ||
15 | src/lxc/conf.c | 20 ++++++++++++++++---- | ||
16 | 1 file changed, 16 insertions(+), 4 deletions(-) | ||
17 | |||
18 | diff --git a/src/lxc/conf.c b/src/lxc/conf.c | ||
19 | index 034bdff..bcba0f1 100644 | ||
20 | --- a/src/lxc/conf.c | ||
21 | +++ b/src/lxc/conf.c | ||
22 | @@ -2623,6 +2623,7 @@ void restore_phys_nics_to_netns(int netnsfd, struct lxc_conf *conf) | ||
23 | { | ||
24 | int i, ret, oldfd; | ||
25 | char path[MAXPATHLEN]; | ||
26 | + char ifname[IFNAMSIZ]; | ||
27 | |||
28 | if (netnsfd < 0) | ||
29 | return; | ||
30 | @@ -2643,9 +2644,13 @@ void restore_phys_nics_to_netns(int netnsfd, struct lxc_conf *conf) | ||
31 | } | ||
32 | for (i=0; i<conf->num_savednics; i++) { | ||
33 | struct saved_nic *s = &conf->saved_nics[i]; | ||
34 | - if (lxc_netdev_move_by_index(s->ifindex, 1, NULL)) | ||
35 | - WARN("Error moving nic index:%d back to host netns", | ||
36 | - s->ifindex); | ||
37 | + /* retrieve the name of the interface */ | ||
38 | + if (!if_indextoname(s->ifindex, ifname)) { | ||
39 | + WARN("no interface corresponding to index '%d'", s->ifindex); | ||
40 | + continue; | ||
41 | + } | ||
42 | + if (lxc_netdev_move_by_name(ifname, 1, NULL)) | ||
43 | + WARN("Error moving nic name:%s back to host netns", ifname); | ||
44 | } | ||
45 | if (setns(oldfd, 0) != 0) | ||
46 | SYSERROR("Failed to re-enter monitor's netns"); | ||
47 | @@ -3208,6 +3213,7 @@ int lxc_assign_network(struct lxc_list *network, pid_t pid) | ||
48 | { | ||
49 | struct lxc_list *iterator; | ||
50 | struct lxc_netdev *netdev; | ||
51 | + char ifname[IFNAMSIZ]; | ||
52 | int am_root = (getuid() == 0); | ||
53 | int err; | ||
54 | |||
55 | @@ -3228,7 +3234,13 @@ int lxc_assign_network(struct lxc_list *network, pid_t pid) | ||
56 | if (!netdev->ifindex) | ||
57 | continue; | ||
58 | |||
59 | - err = lxc_netdev_move_by_index(netdev->ifindex, pid, NULL); | ||
60 | + /* retrieve the name of the interface */ | ||
61 | + if (!if_indextoname(netdev->ifindex, ifname)) { | ||
62 | + ERROR("no interface corresponding to index '%d'", netdev->ifindex); | ||
63 | + return -1; | ||
64 | + } | ||
65 | + | ||
66 | + err = lxc_netdev_move_by_name(ifname, pid, NULL); | ||
67 | if (err) { | ||
68 | ERROR("failed to move '%s' to the container : %s", | ||
69 | netdev->link, strerror(-err)); | ||
70 | -- | ||
71 | 2.7.4 | ||
72 | |||