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

liuhan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-rover.git


The following commit(s) were added to refs/heads/main by this push:
     new f015297  Fix the base image cannot run in the arm64 and address in the 
access log module (#150)
f015297 is described below

commit f015297af988a889b737f7724a3f5c0ad05c5868
Author: mrproliu <[email protected]>
AuthorDate: Tue Oct 22 14:27:56 2024 +0800

    Fix the base image cannot run in the arm64 and address in the access log 
module (#150)
---
 CHANGES.md                         | 13 +++++++++++++
 docker/Dockerfile.base             |  2 +-
 pkg/accesslog/common/connection.go | 17 ++++++++++++-----
 3 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 91bf302..d6a15a1 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -2,6 +2,19 @@ Changes by Version
 ==================
 Release Notes.
 
+0.8.0
+------------------
+#### Features
+
+#### Bug Fixes
+* Fix the base image cannot run in the arm64.
+
+#### Documentation
+
+#### Issues and PR
+- All issues are 
[here](https://github.com/apache/skywalking/milestone/228?closed=1)
+- All and pull requests are 
[here](https://github.com/apache/skywalking-rover/milestone/8?closed=1)
+
 0.7.0
 ------------------
 #### Features
diff --git a/docker/Dockerfile.base b/docker/Dockerfile.base
index 0d57cf1..1424f3d 100644
--- a/docker/Dockerfile.base
+++ b/docker/Dockerfile.base
@@ -16,7 +16,7 @@
 
 FROM golang:1.21
 
-RUN apt update && \
+RUN apt update -y && apt upgrade -y && \
     git clone --depth 1 --branch v1.1.0 https://github.com/libbpf/libbpf.git 
&& \
     mkdir -p /usr/include/bpf && cp libbpf/src/*.h /usr/include/bpf && \
     apt install -y lsb-release wget software-properties-common "$([ $(uname 
-m) = "x86_64" ] && echo "libc6-dev-i386" || echo "libc6-dev-armhf-cross")" && \
diff --git a/pkg/accesslog/common/connection.go 
b/pkg/accesslog/common/connection.go
index 4a960b7..51d418a 100644
--- a/pkg/accesslog/common/connection.go
+++ b/pkg/accesslog/common/connection.go
@@ -246,7 +246,7 @@ func (c *ConnectionManager) Find(event events.Event) 
*ConnectionInfo {
        if e, socket := getSocketPairFromConnectEvent(event); e != nil && 
socket != nil {
                var localAddress, remoteAddress *v3.ConnectionAddress
                localPID, _ := events.ParseConnectionID(event.GetConnectionID())
-               localAddress = 
c.buildAddressFromLocalKubernetesProcess(localPID, socket.SrcPort)
+               localAddress = c.buildLocalAddress(localPID, socket.SrcPort, 
socket)
                remoteAddress = c.buildRemoteAddress(e, socket)
                if localAddress == nil || remoteAddress == nil {
                        return nil
@@ -287,12 +287,12 @@ func (c *ConnectionManager) buildRemoteAddress(e 
*events.SocketConnectEvent, soc
        if addrInfo != nil {
                log.Debugf("building the remote address from %s process, pid: 
%d, connection: %d-%d, role: %s, local: %s:%d, remote: %s:%d",
                        fromType, addrInfo.pid, e.GetConnectionID(), 
e.GetRandomID(), socket.Role, socket.SrcIP, socket.SrcPort, socket.DestIP, 
socket.DestPort)
-               return c.buildAddressFromLocalKubernetesProcess(addrInfo.pid, 
socket.DestPort)
+               return c.buildLocalAddress(addrInfo.pid, socket.DestPort, 
socket)
        } else if tp == addressProcessTypeKubernetes {
                if p := c.localIPWithPid[socket.DestIP]; p != 0 {
                        log.Debugf("building the remote address from kubernetes 
process, connection: %d-%d, role: %s, pid: %d, local: %s:%d, remote: %s:%d",
                                e.GetConnectionID(), e.GetRandomID(), 
socket.Role, p, socket.SrcIP, socket.SrcPort, socket.DestIP, socket.DestPort)
-                       return 
c.buildAddressFromLocalKubernetesProcess(uint32(p), socket.DestPort)
+                       return c.buildLocalAddress(uint32(p), socket.DestPort, 
socket)
                }
        }
 
@@ -364,7 +364,7 @@ func (c *ConnectionManager) buildConnection(event 
*events.SocketConnectEvent, so
        }
 }
 
-func (c *ConnectionManager) buildAddressFromLocalKubernetesProcess(pid uint32, 
port uint16) *v3.ConnectionAddress {
+func (c *ConnectionManager) buildLocalAddress(pid uint32, port uint16, socket 
*ip.SocketPair) *v3.ConnectionAddress {
        c.monitoringProcessLock.RLock()
        defer c.monitoringProcessLock.RUnlock()
        for _, pi := range c.monitoringProcesses[int32(pid)] {
@@ -384,7 +384,14 @@ func (c *ConnectionManager) 
buildAddressFromLocalKubernetesProcess(pid uint32, p
                        }
                }
        }
-       return nil
+       return &v3.ConnectionAddress{
+               Address: &v3.ConnectionAddress_Ip{
+                       Ip: &v3.IPAddress{
+                               Host: socket.SrcIP,
+                               Port: int32(port),
+                       },
+               },
+       }
 }
 
 func (c *ConnectionManager) buildAddressFromRemote(ipHost string, port uint16) 
*v3.ConnectionAddress {

Reply via email to