You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rg...@apache.org on 2019/07/29 02:29:20 UTC

[logging-log4j2] branch release-2.x updated (4ac441d -> 6d02d66)

This is an automated email from the ASF dual-hosted git repository.

rgoers pushed a change to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git.


    from 4ac441d  LOG4J2-2366 - Remove references to LoggerContext when it is shutdown
     new 18560af  Return always six bytes also when there is an ipv4 or ipv6 The localhost address is used for emulate a mac address when is not available
     new 6d02d66  LOG4J2-2650 - Support emulating a MAC address when using ipv6

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/main/java/org/apache/logging/log4j/core/util/NetUtils.java  | 6 +++++-
 src/changes/changes.xml                                             | 3 +++
 2 files changed, 8 insertions(+), 1 deletion(-)


[logging-log4j2] 02/02: LOG4J2-2650 - Support emulating a MAC address when using ipv6

Posted by rg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rgoers pushed a commit to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit 6d02d668a306872d7cc6d1d0bd01bab3c8413ea6
Author: Ralph Goers <rg...@apache.org>
AuthorDate: Sun Jul 28 19:28:29 2019 -0700

    LOG4J2-2650 - Support emulating a MAC address when using ipv6
---
 src/changes/changes.xml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index cff70e8..9ae1fad 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -30,6 +30,9 @@
          - "remove" - Removed
     -->
     <release version="2.12.1" date="2019-MM-DD" description="GA Release 2.12.1">
+      <action issue="LOG4J2-2650" dev="rgoers" type="fix" due-to="Mattia Bertorello">
+        Support emulating a MAC address when using ipv6.
+      </action>
       <action issue="LOG4J2-2366" dev="rgoers" type="fix">
         Remove references to LoggerContext when it is shutdown.
       </action>


[logging-log4j2] 01/02: Return always six bytes also when there is an ipv4 or ipv6 The localhost address is used for emulate a mac address when is not available

Posted by rg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rgoers pushed a commit to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit 18560afaef4300df93b0ff8c85f5acbb932e9573
Author: Mattia Bertorello <m....@arduino.cc>
AuthorDate: Thu Jul 4 12:31:48 2019 +0200

    Return always six bytes also when there is an ipv4 or ipv6
    The localhost address is used for emulate a mac address when is not available
---
 .../src/main/java/org/apache/logging/log4j/core/util/NetUtils.java  | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/NetUtils.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/NetUtils.java
index f3fbff8..e848822 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/NetUtils.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/NetUtils.java
@@ -25,6 +25,7 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.UnknownHostException;
+import java.util.Arrays;
 import java.util.Enumeration;
 
 import org.apache.logging.log4j.Logger;
@@ -105,7 +106,10 @@ public final class NetUtils {
                 LOGGER.catching(e);
             }
             if (mac == null || mac.length == 0) {
-                mac = localHost.getAddress();
+                // Emulate a mac address with an IP v4 or v6
+                final byte[] address = localHost.getAddress();
+                // Take only 6 bytes if the address is an IPv6 otherwise will pad with two zero bytes
+                mac = Arrays.copyOf(address, 6);
             }
         } catch (final UnknownHostException ignored) {
             // ignored