Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pdns: Rename some local identifiers to non-clashing names on Solaris (illumos/SmartOS) #9279

Closed
jurajlutter opened this issue Jun 29, 2020 · 0 comments · Fixed by #9348
Closed
Milestone

Comments

@jurajlutter
Copy link

jurajlutter commented Jun 29, 2020

In recent 4.3.0 there are some local identifiers whose names are causing clash with other identifiers (#define-s) on illumos (SmartOS).

Namely: iputils.hh and lua-record.cc.

The following snippets should fix these warnings/errors:

iputils.hh:

--- pdns/iputils.hh.orig        2020-04-06 12:07:50.000000000 +0000
+++ pdns/iputils.hh
@@ -339,9 +339,9 @@ union ComboAddress {
         index = 32 + index;
       }

-      uint32_t s_addr = ntohl(sin4.sin_addr.s_addr);
+      uint32_t ls_addr = ntohl(sin4.sin_addr.s_addr);

-      return ((s_addr & (1<<index)) != 0x00000000);
+      return ((ls_addr & (1<<index)) != 0x00000000);
     }
     if(isIPv6()) {
       if (index >= 128)
@@ -352,11 +352,11 @@ union ComboAddress {
         index = 128 + index;
       }

-      uint8_t *s_addr = (uint8_t*)sin6.sin6_addr.s6_addr;
+      uint8_t *ls_addr = (uint8_t*)sin6.sin6_addr.s6_addr;
       uint8_t byte_idx = index / 8;
       uint8_t bit_idx = index % 8;

-      return ((s_addr[15-byte_idx] & (1 << bit_idx)) != 0x00);
+      return ((ls_addr[15-byte_idx] & (1 << bit_idx)) != 0x00);
     }
     return false;
   }

lua-record.cc:

--- pdns/lua-record.cc.orig     2020-02-25 06:57:13.000000000 +0000
+++ pdns/lua-record.cc
@@ -658,12 +658,12 @@ void setupLuaRecords()
         for(int i=0; i<8; ++i) {
           if(i)
             together+=":";
-          string quad;
+          string lquad;
           for(int j=0; j <4; ++j) {
-            quad.append(1, labels[31-i*4-j][0]);
+            lquad.append(1, labels[31-i*4-j][0]);
             together += labels[31-i*4-j][0];
           }
-          quads.push_back(quad);
+          quads.push_back(lquad);
         }
         ComboAddress ip6(together,0);

@@ -683,8 +683,8 @@ void setupLuaRecords()
           fmt % labels[i];
         fmt % dashed;

-        for(const auto& quad : quads)
-          fmt % quad;
+        for(const auto& lquad : quads)
+          fmt % lquad;

         return fmt.str();
       }

This fixed the build on SmartOS (and possibly also other platforms).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants