Change-Id: I71f0a7fef55a7a9877de419e84ea756a19af0ea0
Reviewed-on: http://photon-jenkins.eng.vmware.com/1166
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: suezzelur <anishs@vmware.com>
(cherry picked from commit fadbb97ac287154a3918e8f1e57d60dc4b5717ce)
Reviewed-on: http://photon-jenkins.eng.vmware.com/1174
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,186 @@ |
| 0 |
+diff -uNr systemd-228/src/network/networkd-conf.c systemd-228-duid/src/network/networkd-conf.c |
|
| 1 |
+--- systemd-228/src/network/networkd-conf.c 2016-06-21 21:08:43.975661002 +0000 |
|
| 2 |
+@@ -21,9 +21,11 @@ |
|
| 3 |
+ |
|
| 4 |
+ #include <ctype.h> |
|
| 5 |
+ |
|
| 6 |
++#include "alloc-util.h" |
|
| 7 |
+ #include "conf-parser.h" |
|
| 8 |
+ #include "def.h" |
|
| 9 |
+ #include "dhcp-identifier.h" |
|
| 10 |
++#include "hexdecoct.h" |
|
| 11 |
+ #include "networkd-conf.h" |
|
| 12 |
+ #include "string-table.h" |
|
| 13 |
+ |
|
| 14 |
+@@ -32,7 +34,7 @@ |
|
| 15 |
+ |
|
| 16 |
+ return config_parse_many(PKGSYSCONFDIR "/networkd.conf", |
|
| 17 |
+ CONF_PATHS_NULSTR("systemd/networkd.conf.d"),
|
|
| 18 |
+- "DUID\0", |
|
| 19 |
++ "DHCP\0", |
|
| 20 |
+ config_item_perf_lookup, networkd_gperf_lookup, |
|
| 21 |
+ false, m); |
|
| 22 |
+ } |
|
| 23 |
+@@ -58,17 +60,13 @@ |
|
| 24 |
+ const char *rvalue, |
|
| 25 |
+ void *data, |
|
| 26 |
+ void *userdata) {
|
|
| 27 |
+- int r; |
|
| 28 |
+- long byte; |
|
| 29 |
+- char *cbyte, *pnext; |
|
| 30 |
+- const char *pduid = rvalue; |
|
| 31 |
+- size_t count = 0, duid_index = 0; |
|
| 32 |
+ Manager *m; |
|
| 33 |
+ Network *n; |
|
| 34 |
+ DUIDType *duid_type; |
|
| 35 |
+ uint16_t *dhcp_duid_type; |
|
| 36 |
+ size_t *dhcp_duid_len; |
|
| 37 |
+ uint8_t *dhcp_duid; |
|
| 38 |
++ size_t count = 0; |
|
| 39 |
+ |
|
| 40 |
+ assert(filename); |
|
| 41 |
+ assert(lvalue); |
|
| 42 |
+@@ -90,66 +88,50 @@ |
|
| 43 |
+ dhcp_duid = n->dhcp_duid; |
|
| 44 |
+ } |
|
| 45 |
+ |
|
| 46 |
+- if (*duid_type == _DUID_TYPE_INVALID) |
|
| 47 |
+- *duid_type = DUID_TYPE_RAW; |
|
| 48 |
+- |
|
| 49 |
+- switch (*duid_type) {
|
|
| 50 |
+- case DUID_TYPE_LLT: |
|
| 51 |
+- /* RawData contains DUID-LLT link-layer address (offset 6) */ |
|
| 52 |
+- duid_index = 6; |
|
| 53 |
+- break; |
|
| 54 |
+- case DUID_TYPE_EN: |
|
| 55 |
+- /* RawData contains DUID-EN identifier (offset 4) */ |
|
| 56 |
+- duid_index = 4; |
|
| 57 |
+- break; |
|
| 58 |
+- case DUID_TYPE_LL: |
|
| 59 |
+- /* RawData contains DUID-LL link-layer address (offset 2) */ |
|
| 60 |
+- duid_index = 2; |
|
| 61 |
+- break; |
|
| 62 |
+- case DUID_TYPE_UUID: |
|
| 63 |
+- /* RawData specifies UUID (offset 0) - fall thru */ |
|
| 64 |
+- case DUID_TYPE_RAW: |
|
| 65 |
+- /* First two bytes of RawData is DUID Type - fall thru */ |
|
| 66 |
+- default: |
|
| 67 |
+- break; |
|
| 68 |
++ if ((*duid_type < DUID_TYPE_LLT) || (*duid_type > DUID_TYPE_UUID)) {
|
|
| 69 |
++ log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid DUID type, ignoring assignment: %s.", rvalue); |
|
| 70 |
++ return 0; |
|
| 71 |
+ } |
|
| 72 |
++ *dhcp_duid_type = (uint16_t)(*duid_type); |
|
| 73 |
+ |
|
| 74 |
+- if (*duid_type != DUID_TYPE_RAW) |
|
| 75 |
+- *dhcp_duid_type = (uint16_t)(*duid_type); |
|
| 76 |
++ /* RawData contains DUID in format "NN:NN:NN..." */ |
|
| 77 |
++ for (;;) {
|
|
| 78 |
++ int n1, n2, len, r; |
|
| 79 |
++ uint32_t byte; |
|
| 80 |
++ _cleanup_free_ char *cbyte = NULL; |
|
| 81 |
+ |
|
| 82 |
+- /* RawData contains DUID in format " NN:NN:NN... " */ |
|
| 83 |
+- while (true) {
|
|
| 84 |
+- r = extract_first_word(&pduid, &cbyte, ":", 0); |
|
| 85 |
++ r = extract_first_word(&rvalue, &cbyte, ":", 0); |
|
| 86 |
+ if (r < 0) {
|
|
| 87 |
+- log_error("Failed to read DUID.");
|
|
| 88 |
+- return -EINVAL; |
|
| 89 |
++ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to read DUID, ignoring assignment: %s.", rvalue); |
|
| 90 |
++ return 0; |
|
| 91 |
+ } |
|
| 92 |
+ if (r == 0) |
|
| 93 |
+ break; |
|
| 94 |
+- if (duid_index >= MAX_DUID_LEN) {
|
|
| 95 |
+- log_error("DUID length exceeds maximum length.");
|
|
| 96 |
+- return -EINVAL; |
|
| 97 |
++ if (count >= MAX_DUID_LEN) {
|
|
| 98 |
++ log_syntax(unit, LOG_ERR, filename, line, 0, "Max DUID length exceeded, ignoring assignment: %s.", rvalue); |
|
| 99 |
++ return 0; |
|
| 100 |
+ } |
|
| 101 |
+ |
|
| 102 |
+- errno = 0; |
|
| 103 |
+- byte = strtol(cbyte, &pnext, 16); |
|
| 104 |
+- if ((errno == ERANGE && (byte == LONG_MAX || byte == LONG_MIN)) |
|
| 105 |
+- || (errno != 0 && byte == 0) || (cbyte == pnext)) {
|
|
| 106 |
+- log_error("Invalid DUID byte: %s.", cbyte);
|
|
| 107 |
+- return -EINVAL; |
|
| 108 |
++ len = strlen(cbyte); |
|
| 109 |
++ if (len != 1 && len != 2) {
|
|
| 110 |
++ log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid length - DUID byte: %s, ignoring assignment: %s.", cbyte, rvalue); |
|
| 111 |
++ return 0; |
|
| 112 |
+ } |
|
| 113 |
+- |
|
| 114 |
+- /* If DUID_TYPE_RAW, first two bytes hold DHCP DUID type code */ |
|
| 115 |
+- if ((*duid_type == DUID_TYPE_RAW) && (count < 2)) {
|
|
| 116 |
+- *dhcp_duid_type |= (byte << (8 * (1 - count))); |
|
| 117 |
+- count++; |
|
| 118 |
+- continue; |
|
| 119 |
++ n1 = unhexchar(cbyte[0]); |
|
| 120 |
++ if (len == 2) |
|
| 121 |
++ n2 = unhexchar(cbyte[1]); |
|
| 122 |
++ else |
|
| 123 |
++ n2 = 0; |
|
| 124 |
++ |
|
| 125 |
++ if (n1 < 0 || n2 < 0) {
|
|
| 126 |
++ log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid DUID byte: %s. Ignoring assignment: %s.", cbyte, rvalue); |
|
| 127 |
++ return 0; |
|
| 128 |
+ } |
|
| 129 |
+ |
|
| 130 |
+- dhcp_duid[duid_index++] = byte; |
|
| 131 |
++ byte = ((uint8_t) n1 << (4 * (len-1))) | (uint8_t) n2; |
|
| 132 |
++ dhcp_duid[count++] = byte; |
|
| 133 |
+ } |
|
| 134 |
+ |
|
| 135 |
+- *dhcp_duid_len = duid_index; |
|
| 136 |
+- |
|
| 137 |
++ *dhcp_duid_len = count; |
|
| 138 |
+ return 0; |
|
| 139 |
+ } |
|
| 140 |
+diff -uNr systemd-228/src/network/networkd-gperf.gperf systemd-228-duid/src/network/networkd-gperf.gperf |
|
| 141 |
+--- systemd-228/src/network/networkd-gperf.gperf 2016-06-21 21:08:43.975661002 +0000 |
|
| 142 |
+@@ -14,5 +14,5 @@ |
|
| 143 |
+ %struct-type |
|
| 144 |
+ %includes |
|
| 145 |
+ %% |
|
| 146 |
+-DUID.Type, config_parse_duid_type, 0, offsetof(Manager, duid_type) |
|
| 147 |
+-DUID.RawData, config_parse_duid_rawdata, DUID_CONFIG_SOURCE_GLOBAL, offsetof(Manager, dhcp_duid) |
|
| 148 |
++DHCP.DUIDType, config_parse_duid_type, 0, offsetof(Manager, duid_type) |
|
| 149 |
++DHCP.DUIDRawData, config_parse_duid_rawdata, DUID_CONFIG_SOURCE_GLOBAL, offsetof(Manager, dhcp_duid) |
|
| 150 |
+diff -uNr systemd-228/src/network/networkd-network-gperf.gperf systemd-228-duid/src/network/networkd-network-gperf.gperf |
|
| 151 |
+--- systemd-228/src/network/networkd-network-gperf.gperf 2016-06-21 21:08:43.975661002 +0000 |
|
| 152 |
+@@ -27,9 +27,6 @@ |
|
| 153 |
+ Match.Architecture, config_parse_net_condition, CONDITION_ARCHITECTURE, offsetof(Network, match_arch) |
|
| 154 |
+ Link.MACAddress, config_parse_hwaddr, 0, offsetof(Network, mac) |
|
| 155 |
+ Link.MTUBytes, config_parse_iec_size, 0, offsetof(Network, mtu) |
|
| 156 |
+-Link.IAID, config_parse_iaid, 0, offsetof(Network, iaid) |
|
| 157 |
+-DUID.Type, config_parse_duid_type, 0, offsetof(Network, duid_type) |
|
| 158 |
+-DUID.RawData, config_parse_duid_rawdata, DUID_CONFIG_SOURCE_NETWORK, offsetof(Network, dhcp_duid) |
|
| 159 |
+ Network.Description, config_parse_string, 0, offsetof(Network, description) |
|
| 160 |
+ Network.Bridge, config_parse_netdev, 0, offsetof(Network, bridge) |
|
| 161 |
+ Network.Bond, config_parse_netdev, 0, offsetof(Network, bond) |
|
| 162 |
+@@ -82,6 +79,9 @@ |
|
| 163 |
+ DHCP.VendorClassIdentifier, config_parse_string, 0, offsetof(Network, dhcp_vendor_class_identifier) |
|
| 164 |
+ DHCP.RouteMetric, config_parse_unsigned, 0, offsetof(Network, dhcp_route_metric) |
|
| 165 |
+ DHCP.UseTimezone, config_parse_bool, 0, offsetof(Network, dhcp_timezone) |
|
| 166 |
++DHCP.DUIDType, config_parse_duid_type, 0, offsetof(Network, duid_type) |
|
| 167 |
++DHCP.DUIDRawData, config_parse_duid_rawdata, DUID_CONFIG_SOURCE_NETWORK, offsetof(Network, dhcp_duid) |
|
| 168 |
++DHCP.IAID, config_parse_iaid, 0, offsetof(Network, iaid) |
|
| 169 |
+ DHCPServer.MaxLeaseTimeSec, config_parse_sec, 0, offsetof(Network, dhcp_server_max_lease_time_usec) |
|
| 170 |
+ DHCPServer.DefaultLeaseTimeSec, config_parse_sec, 0, offsetof(Network, dhcp_server_default_lease_time_usec) |
|
| 171 |
+ DHCPServer.EmitDNS, config_parse_bool, 0, offsetof(Network, dhcp_server_emit_dns) |
|
| 172 |
+diff -uNr systemd-228/src/network/networkd-network.c systemd-228-duid/src/network/networkd-network.c |
|
| 173 |
+--- systemd-228/src/network/networkd-network.c 2016-06-21 21:08:43.975661002 +0000 |
|
| 174 |
+@@ -133,7 +133,6 @@ |
|
| 175 |
+ r = config_parse(NULL, filename, file, |
|
| 176 |
+ "Match\0" |
|
| 177 |
+ "Link\0" |
|
| 178 |
+- "DUID\0" |
|
| 179 |
+ "Network\0" |
|
| 180 |
+ "Address\0" |
|
| 181 |
+ "Route\0" |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
Summary: Systemd-228 |
| 2 | 2 |
Name: systemd |
| 3 | 3 |
Version: 228 |
| 4 |
-Release: 24%{?dist}
|
|
| 4 |
+Release: 25%{?dist}
|
|
| 5 | 5 |
License: LGPLv2+ and GPLv2+ and MIT |
| 6 | 6 |
URL: http://www.freedesktop.org/wiki/Software/systemd/ |
| 7 | 7 |
Group: System Environment/Security |
| ... | ... |
@@ -28,6 +28,7 @@ Patch12: systemd-228-query-duid.patch |
| 28 | 28 |
Patch13: systemd-228-pam-systemd-user.patch |
| 29 | 29 |
Patch14: systemd-228-ipv6-disabled-fix.patch |
| 30 | 30 |
Patch15: systemd-228-default-dns-from-env.patch |
| 31 |
+Patch16: systemd-228-dhcp-duid-api-update.patch |
|
| 31 | 32 |
Requires: Linux-PAM |
| 32 | 33 |
Requires: libcap |
| 33 | 34 |
Requires: xz |
| ... | ... |
@@ -76,6 +77,7 @@ sed -i "s:blkid/::" $(grep -rl "blkid/blkid.h") |
| 76 | 76 |
%patch13 -p1 |
| 77 | 77 |
%patch14 -p1 |
| 78 | 78 |
%patch15 -p1 |
| 79 |
+%patch16 -p1 |
|
| 79 | 80 |
sed -i "s#\#DefaultTasksMax=512#DefaultTasksMax=infinity#g" src/core/system.conf |
| 80 | 81 |
|
| 81 | 82 |
%build |
| ... | ... |
@@ -180,6 +182,8 @@ rm -rf %{buildroot}/*
|
| 180 | 180 |
%dir %{_localstatedir}/log/journal
|
| 181 | 181 |
|
| 182 | 182 |
%changelog |
| 183 |
+* Mon Jul 11 2016 Vinay Kulkarni <kulkarniv@vmware.com> 228-25 |
|
| 184 |
+- systemd-networkd: Update DUID/IAID config interface to systemd v230 spec. |
|
| 183 | 185 |
* Tue Jun 21 2016 Anish Swaminathan <anishs@vmware.com> 228-24 |
| 184 | 186 |
- Change config file properties |
| 185 | 187 |
* Fri Jun 17 2016 Vinay Kulkarni <kulkarniv@vmware.com> 228-23 |