[systemd-bugs] [Bug 82721] New: systemd-networkd nonsense

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sun Aug 17 00:38:34 PDT 2014


https://bugs.freedesktop.org/show_bug.cgi?id=82721

          Priority: medium
            Bug ID: 82721
          Assignee: systemd-bugs at lists.freedesktop.org
           Summary: systemd-networkd nonsense
        QA Contact: systemd-bugs at lists.freedesktop.org
          Severity: normal
    Classification: Unclassified
                OS: All
          Reporter: mustrumr97 at gmail.com
          Hardware: Other
            Status: NEW
           Version: unspecified
         Component: general
           Product: systemd

In src/network/networkd-link.c link_save():

--
  1365                            fprintf(f, "%s%s", *address,
  1366                                    (address + 1 ? " " : ""));
--
  1380                            fprintf(f, "%s%s", *address,
  1381                                    (address + 1 ? " " : ""));
--
  1395                            fprintf(f, "%s%s", *domain,
  1396                                    (domain + 1 ? " " : ""));

THIS DOES NOT MAKE SENSE!

address and domain will almost never equal ((char*)NULL)-1 because they are
pointers to allocated storage and (usually) the higher half of the address
space is reserved for the kernel.

You probably meant *(address+1) and *(domain+1). That would make sense however
it would break DHCP (you append an address/domain and then append " ").
Therefore the behavior should be preserved and spaces should always be
appended.

I know your love for patches submitted through bugzilla. I will never send the
following patch to the mailing list:

--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -1727,8 +1727,7 @@
                 fputs("DNS=", f);

                 STRV_FOREACH(address, link->network->dns)
-                        fprintf(f, "%s%s", *address,
-                                (address + 1 ? " " : ""));
+                        fprintf(f, "%s ", *address);

                 if (link->network->dhcp_dns &&
                     link->dhcp_lease) {
@@ -1747,8 +1746,7 @@
                 fprintf(f, "NTP=");

                 STRV_FOREACH(address, link->network->ntp)
-                        fprintf(f, "%s%s", *address,
-                                (address + 1 ? " " : ""));
+                        fprintf(f, "%s ", *address);

                 if (link->network->dhcp_ntp &&
                     link->dhcp_lease) {
@@ -1767,8 +1765,7 @@
                 fprintf(f, "DOMAINS=");

                 STRV_FOREACH(domain, link->network->domains)
-                        fprintf(f, "%s%s", *domain,
-                                (domain + 1 ? " " : ""));
+                        fprintf(f, "%s ", *domain);

                 if (link->network->dhcp_domains &&
                     link->dhcp_lease) {


P.S.: Thanks for implementing domains.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-bugs/attachments/20140817/a299766a/attachment.html>


More information about the systemd-bugs mailing list