This is an automated email from the ASF dual-hosted git repository.
liuhan pushed a commit to branch reduce-handle-connect-time
in repository https://gitbox.apache.org/repos/asf/skywalking-rover.git
The following commit(s) were added to refs/heads/reduce-handle-connect-time by
this push:
new 548ac0a update conntrack
548ac0a is described below
commit 548ac0a3582663a10747e89b2df7440035d27bd2
Author: mrproliu <[email protected]>
AuthorDate: Sat Dec 28 16:01:04 2024 +0800
update conntrack
---
pkg/tools/ip/conntrack.go | 41 +----------------------------------------
1 file changed, 1 insertion(+), 40 deletions(-)
diff --git a/pkg/tools/ip/conntrack.go b/pkg/tools/ip/conntrack.go
index 88b868a..8512822 100644
--- a/pkg/tools/ip/conntrack.go
+++ b/pkg/tools/ip/conntrack.go
@@ -58,45 +58,6 @@ func NewConnTrack() (*ConnTrack, error) {
return nil, err
}
- go func() {
- client, _ := conntrack.Dial(nil)
- evCh := make(chan conntrack.Event, 2048)
-
- errCh, err := client.Listen(evCh, 4, []netfilter.NetlinkGroup{
- netfilter.GroupCTNew, // watching for new conntrack
events
- })
- if err != nil {
- log.Errorf("++++++: %v", err)
- }
-
- client.SetReadBuffer(26214400) // 25MB
- // Listen to Conntrack events from all network namespaces on
the system.
- err = client.SetOption(netlink.ListenAllNSID, true)
- if err != nil {
- log.Errorf("0-------: %v", err)
- }
-
- // Start a goroutine to print all incoming messages on the
event channel.
- go func() {
- for {
- e := <-evCh
- if e.Flow.TupleOrig.Proto.DestinationPort == 53
{
- continue
- }
- log.Infof("conntrack: type: %s, origin:
%s:%d->%s:%d, reply: %s:%d->%s:%d", e.Type,
- e.Flow.TupleOrig.IP.SourceAddress,
e.Flow.TupleOrig.Proto.SourcePort,
- e.Flow.TupleOrig.IP.DestinationAddress,
e.Flow.TupleOrig.Proto.DestinationPort,
- e.Flow.TupleReply.IP.SourceAddress,
e.Flow.TupleReply.Proto.SourcePort,
-
e.Flow.TupleReply.IP.DestinationAddress,
e.Flow.TupleReply.Proto.DestinationPort)
- }
- }()
-
- // Stop the program as soon as an error is caught in a decoder
goroutine.
- if err := <-errCh; err != nil {
- log.Errorf("conntrack error: %v", err)
- }
- }()
-
return &ConnTrack{
queryClient: queryClient,
eventChain: make(chan conntrack.Event, 2048),
@@ -164,7 +125,7 @@ func (c *ConnTrack) monitor0(ctx context.Context) (chan
error, error) {
// Listen to Conntrack events from all network namespaces on the system.
err = c.monitorClient.SetOption(netlink.ListenAllNSID, true)
if err != nil {
- return nil, err
+ log.Warnf("set connect track listen all nsid error: %v", err)
}
// is not the first monitoring, then return(no need re monitoring the
channel)