Change-Id: I8f7a004a962f9575b707b796b8cc51959dec4fe0
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/3828
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Vinay Kulkarni <kulkarniv@vmware.com>
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,203 @@ |
0 |
+diff -uNr nm_dev/cli/netmgrcli.c nm_dev2/cli/netmgrcli.c |
|
1 |
+--- nm_dev/cli/netmgrcli.c 2017-09-21 04:01:44.873130240 +0000 |
|
2 |
+@@ -807,6 +807,91 @@ |
|
3 |
+ goto cleanup; |
|
4 |
+ } |
|
5 |
+ |
|
6 |
++static uint32_t |
|
7 |
++cli_set_duid( |
|
8 |
++ int argc, |
|
9 |
++ char **argv, |
|
10 |
++ PNETMGR_CMD pCmd |
|
11 |
++ ) |
|
12 |
++{ |
|
13 |
++ uint32_t err = 0; |
|
14 |
++ |
|
15 |
++ pCmd->id = CMD_DHCP_DUID; |
|
16 |
++ pCmd->op = OP_SET; |
|
17 |
++ |
|
18 |
++ if (argc < 3) |
|
19 |
++ { |
|
20 |
++ fprintf(stderr, "Usage: set_duid <duid>\n"); |
|
21 |
++ err = EDOM; |
|
22 |
++ bail_on_error(err); |
|
23 |
++ } |
|
24 |
++ |
|
25 |
++ if (strlen(argv[2]) > 0) |
|
26 |
++ { |
|
27 |
++ err = netmgrcli_alloc_keyvalue("duid", argv[2], pCmd); |
|
28 |
++ } |
|
29 |
++ else |
|
30 |
++ { |
|
31 |
++ err = netmgrcli_alloc_keyvalue("duid", "", pCmd); |
|
32 |
++ } |
|
33 |
++ bail_on_error(err); |
|
34 |
++ |
|
35 |
++cleanup: |
|
36 |
++ return err; |
|
37 |
++ |
|
38 |
++error: |
|
39 |
++ pCmd->op = OP_INVALID; |
|
40 |
++ goto cleanup; |
|
41 |
++} |
|
42 |
++ |
|
43 |
++static uint32_t |
|
44 |
++cli_set_iaid( |
|
45 |
++ int argc, |
|
46 |
++ char **argv, |
|
47 |
++ PNETMGR_CMD pCmd |
|
48 |
++ ) |
|
49 |
++{ |
|
50 |
++ uint32_t err = 0; |
|
51 |
++ |
|
52 |
++ pCmd->id = CMD_IF_IAID; |
|
53 |
++ pCmd->op = OP_SET; |
|
54 |
++ |
|
55 |
++ if (argc < 4) |
|
56 |
++ { |
|
57 |
++ fprintf(stderr, "Usage: set_iaid <ifname> <iaid>\n"); |
|
58 |
++ err = EDOM; |
|
59 |
++ bail_on_error(err); |
|
60 |
++ } |
|
61 |
++ |
|
62 |
++ if (strlen(argv[2]) > 0) |
|
63 |
++ { |
|
64 |
++ err = netmgrcli_alloc_keyvalue("interface", argv[2], pCmd); |
|
65 |
++ } |
|
66 |
++ else |
|
67 |
++ { |
|
68 |
++ fprintf(stderr, "Invalid interface name.\n"); |
|
69 |
++ err = EDOM; |
|
70 |
++ } |
|
71 |
++ bail_on_error(err); |
|
72 |
++ |
|
73 |
++ if (strlen(argv[3]) > 0) |
|
74 |
++ { |
|
75 |
++ err = netmgrcli_alloc_keyvalue("iaid", argv[3], pCmd); |
|
76 |
++ } |
|
77 |
++ else |
|
78 |
++ { |
|
79 |
++ err = netmgrcli_alloc_keyvalue("iaid", "", pCmd); |
|
80 |
++ } |
|
81 |
++ bail_on_error(err); |
|
82 |
++ |
|
83 |
++cleanup: |
|
84 |
++ return err; |
|
85 |
++ |
|
86 |
++error: |
|
87 |
++ pCmd->op = OP_INVALID; |
|
88 |
++ goto cleanup; |
|
89 |
++} |
|
90 |
++ |
|
91 |
+ |
|
92 |
+ static struct option dnsServerOptions[] = |
|
93 |
+ { |
|
94 |
+@@ -919,6 +1004,18 @@ |
|
95 |
+ goto cleanup; |
|
96 |
+ } |
|
97 |
+ |
|
98 |
++static uint32_t |
|
99 |
++cli_get_dns_servers( |
|
100 |
++ int argc, |
|
101 |
++ char **argv, |
|
102 |
++ PNETMGR_CMD pCmd |
|
103 |
++ ) |
|
104 |
++{ |
|
105 |
++ pCmd->id = CMD_DNS_SERVERS; |
|
106 |
++ pCmd->op = OP_GET; |
|
107 |
++ return 0; |
|
108 |
++} |
|
109 |
++ |
|
110 |
+ |
|
111 |
+ static struct option dnsDomainsOptions[] = |
|
112 |
+ { |
|
113 |
+@@ -1598,7 +1695,7 @@ |
|
114 |
+ "--set --duid <DUID string> --interface <interface name>", |
|
115 |
+ "get or set DHCP DUID, optionally per interface" |
|
116 |
+ }, |
|
117 |
+- {"if_iaid", |
|
118 |
++ {"if_iaid ", |
|
119 |
+ cli_if_iaid, |
|
120 |
+ "--set --iaid <IAID value> --interface <interface name>", |
|
121 |
+ "get or set interface IAID" |
|
122 |
+@@ -1635,6 +1732,21 @@ |
|
123 |
+ "--paramvalue <value>", |
|
124 |
+ "get or set network configuration parameters" |
|
125 |
+ }, |
|
126 |
++ {"set_duid", |
|
127 |
++ cli_set_duid, |
|
128 |
++ "", |
|
129 |
++ "This is deprecated, will be removed in the future. Please use 'dhcp_duid --set'", |
|
130 |
++ }, |
|
131 |
++ {"set_iaid", |
|
132 |
++ cli_set_iaid, |
|
133 |
++ "", |
|
134 |
++ "This is deprecated, will be removed in the future. Please use 'if_iaid --set'", |
|
135 |
++ }, |
|
136 |
++ {"get_dns_servers", |
|
137 |
++ cli_get_dns_servers, |
|
138 |
++ "", |
|
139 |
++ "This is deprecated, will be removed in the future. Please use 'dns_servers --get'", |
|
140 |
++ }, |
|
141 |
+ }; |
|
142 |
+ |
|
143 |
+ static uint32_t |
|
144 |
+@@ -1653,7 +1765,7 @@ |
|
145 |
+ |
|
146 |
+ for(i = 0; i < nCmdCount; ++i) |
|
147 |
+ { |
|
148 |
+- fprintf(stdout, "%s \t%s\n", |
|
149 |
++ fprintf(stdout, "%s\t %s\n", |
|
150 |
+ cmdMap[i].pszCmdName, |
|
151 |
+ cmdMap[i].pszHelpMessage); |
|
152 |
+ } |
|
153 |
+diff -uNr nm_dev/src/netmgr.c nm_dev2/src/netmgr.c |
|
154 |
+--- nm_dev/src/netmgr.c 2017-09-21 04:01:41.517130080 +0000 |
|
155 |
+@@ -481,6 +481,7 @@ |
|
156 |
+ { |
|
157 |
+ *ppszFilename = NULL; |
|
158 |
+ } |
|
159 |
++ netmgr_free(pszNewFilename); |
|
160 |
+ goto cleanup; |
|
161 |
+ } |
|
162 |
+ |
|
163 |
+diff -uNr nm_dev/src/utils.c nm_dev2/src/utils.c |
|
164 |
+--- nm_dev/src/utils.c 2017-09-21 04:01:44.873130240 +0000 |
|
165 |
+@@ -61,10 +61,19 @@ |
|
166 |
+ err = NM_ERR_BAD_CONFIG_FILE; |
|
167 |
+ bail_on_error(err); |
|
168 |
+ } |
|
169 |
+- else if ((dwNumSections == 0) && (pszValue != NULL)) |
|
170 |
++ else if (dwNumSections == 0) |
|
171 |
+ { |
|
172 |
+- err = ini_cfg_add_section(pConfig, pszSection, &pSection); |
|
173 |
+- bail_on_error(err); |
|
174 |
++ if (pszValue != NULL) |
|
175 |
++ { |
|
176 |
++ err = ini_cfg_add_section(pConfig, pszSection, &pSection); |
|
177 |
++ bail_on_error(err); |
|
178 |
++ } |
|
179 |
++ else |
|
180 |
++ { |
|
181 |
++ /* Bug out with success - nothing to set, no section found. */ |
|
182 |
++ err = 0; |
|
183 |
++ goto error; |
|
184 |
++ } |
|
185 |
+ } |
|
186 |
+ else |
|
187 |
+ { |
|
188 |
+diff -uNr nm_dev/tests/Makefile.am nm_dev2/tests/Makefile.am |
|
189 |
+--- nm_dev/tests/Makefile.am 2017-09-21 04:01:44.873130240 +0000 |
|
190 |
+@@ -44,7 +44,7 @@ |
|
191 |
+ docker build --build-arg NMROOT=$(ABSTOPDIR) -t netmgr_ut . && \ |
|
192 |
+ docker run -d --name netmgr_unittest --privileged --cap-add=SYS_ADMIN \ |
|
193 |
+ --cap-add=NET_ADMIN --security-opt seccomp=unconfined \ |
|
194 |
+- --stop-signal=SIGRTMIN+3 --tmpfs --cap-add=/run --tmpfs /run/lock \ |
|
195 |
++ --stop-signal=SIGRTMIN+3 --tmpfs /run --tmpfs /run/lock \ |
|
196 |
+ -v /sys/fs/cgroup:/sys/fs/cgroup:ro netmgr_ut && sleep 2 && \ |
|
197 |
+ docker exec -ti netmgr_unittest /netmgr/unittest/run_tests.sh && \ |
|
198 |
+ docker kill netmgr_unittest && docker rm netmgr_unittest && \ |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
Summary: PhotonOS Network Management Utilities |
2 | 2 |
Name: netmgmt |
3 | 3 |
Version: 1.1.0 |
4 |
-Release: 5%{?dist} |
|
4 |
+Release: 6%{?dist} |
|
5 | 5 |
Group: Applications/System |
6 | 6 |
Vendor: VMware, Inc. |
7 | 7 |
License: Apache2.0 |
... | ... |
@@ -10,6 +10,7 @@ Source0: %{name}-%{version}.tar.gz |
10 | 10 |
Patch0: netmgmt-1.1.0-2.patch |
11 | 11 |
Patch1: netmgmt-1.1.0-coverity-and-bug-fix.patch |
12 | 12 |
Patch2: netmgmt-1.1.0-carry-match-conf-fix.patch |
13 |
+Patch3: netmgmt-1.1.0-back-compat.patch |
|
13 | 14 |
Distribution: Photon |
14 | 15 |
BuildRequires: autoconf |
15 | 16 |
BuildRequires: check >= 0.9.4 |
... | ... |
@@ -47,6 +48,7 @@ header files and libraries for netmgmt cli |
47 | 47 |
%patch0 -p1 |
48 | 48 |
%patch1 -p1 |
49 | 49 |
%patch2 -p1 |
50 |
+%patch3 -p1 |
|
50 | 51 |
|
51 | 52 |
%build |
52 | 53 |
autoreconf -mif |
... | ... |
@@ -88,6 +90,8 @@ find %{buildroot} -name '*.la' -delete |
88 | 88 |
# %doc ChangeLog README COPYING |
89 | 89 |
|
90 | 90 |
%changelog |
91 |
+* Wed Sep 20 2017 Vinay Kulkarni <kulkarniv@vmware.com> 1.1.0-6 |
|
92 |
+- Backward compatibility interface. |
|
91 | 93 |
* Sat Sep 09 2017 Vinay Kulkarni <kulkarniv@vmware.com> 1.1.0-5 |
92 | 94 |
- Retain current match conf when creating interface specific conf. |
93 | 95 |
* Tue Aug 09 2017 Vinay Kulkarni <kulkarniv@vmware.com> 1.1.0-4 |