Giter VIP home page Giter VIP logo

trex-emu's Issues

Failed to create ZMQ RPC server - interrupted system call

	if err != nil {
		errStr := fmt.Sprintf("Failed to create ZMQ RPC server - %v", err.Error())
		log.Fatalln(errStr)

It is a valid to get this error, need to add a few reties with sleep

while ( ) {
  rc = socket.Bind()
  zmq_errno () != EINTR) 
}

doc still requires python2

Building the doc for trex-emu requires Python 2.7. This should be compliant with trex-core where Python 2.7 is not required.

Reproduce:

trex@trex-UCSC-C220-M5SX:~/trex/trex-emu/doc$ pwd
/home/trex/trex/trex-emu/doc
trex@trex-UCSC-C220-M5SX:~/trex/trex-emu/doc$ ./b configure
Required Python 2.7 (Asciidoc requirement)

Simulator veth interface doesn't flush Rx queue if duration passes.

Not sure if this is the intended design or this is a bug.

func (o *CThreadCtx) MainLoopSim(duration time.Duration) {

In the MainLoopSim, if tick > maxtick we break out of the loop, without checking Rx queue. I would expect that this would be done in o.Veth.SimulatorCleanup() , but it isn't

func (o *VethIFZmq) SimulatorCleanup() {

The main problem with this are counters, since they can go out of sync. For example in a loopback between two clients in mDNS:

	{
		"pktRxMDnsQuery": 4,
		"pktTxMDnsQuery": 5,
		"pktTxMDnsResponse": 4
	},
	{
		"pktRxMDnsQuery": 5,
		"pktTxMDnsQuery": 5,
		"pktTxMDnsResponse": 5
	},

We can see that both clients transmitted 5 queries, one received 5 and answered to 5, but the other client received only 4 and answered to only 4.

The real question is what would be the implications of adding a call to

func (o *VethIFZmq) SimulatorCheckRxQueue() {

in SimulatorCleanup ?

UnmarshalValidate doesn't work for slices.

The function UnmarshalValidate will fail validating slices, arrays or maps.
Take for example:

type Person struct {
      Name string      `json:"name" validate:"required"`
      Age     int      `json:"age" validate:"required"`
}
type PersonList struct {
       People []Person `json:"people" validate:"required"`
}

json := fastjson.RawMessage([]byte(`
{
    "people": [
           {
                  "name": "Bes",
                  "age": 25
           }
     ]
}`))

The data will be decoded successfully but when we attempt validating at o.validate.Struct(v), we will fail.
This will happen even if we use the "dive" flag in validate.
Instead of using o.validate.Struct(v), we should probably use validate.Var(v, "dive").

This is a good reference from the validator package: go-playground/validator#309

EMU crash with error: Assertion failed: pfd.revents & POLLIN (src/signaler.cpp:264)

trex-emu crashes sometimes when we run it with kernel-mode.

./trex-emu -k

Run ZMQ server on [RPC:4500, RX: IPC, TX:IPC]
Assertion failed: pfd.revents & POLLIN (src/signaler.cpp:264)
SIGABRT: abort
PC=0x7f94007ad00b m=8 sigcode=18446744073709551610
signal arrived during cgo execution

goroutine 19 [syscall]:
runtime.cgocall(0x8d10f0, 0xc000052688)
	/usr/local/go/src/runtime/cgocall.go:157 +0x5c fp=0xc000052660 sp=0xc000052628 pc=0x4072dc
github.com/pebbe/zmq4._C2func_zmq4_msg_recv(0xc0005adc80, 0x2c017b0, 0x0)
	_cgo_gotypes.go:401 +0x56 fp=0xc000052688 sp=0xc000052660 pc=0x7578d6
github.com/pebbe/zmq4.(*Socket).RecvBytes.func1(0xc0005adc80?, 0x0?, 0x0)
	/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/pkg/mod/github.com/pebbe/[email protected]/zmq4.go:1082 +0x57 fp=0xc0000526d8 sp=0xc000052688 pc=0x7609b7
github.com/pebbe/zmq4.(*Socket).RecvBytes(0xc00028d6e0, 0xc00017e370?)
	/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/pkg/mod/github.com/pebbe/[email protected]/zmq4.go:1082 +0x119 fp=0xc000052778 sp=0xc0000526d8 pc=0x760619
emu/core.(*CZmqJsonRPC2).rxThread(0xc00029d088)
	/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/core/rpc.go:86 +0x45 fp=0xc0000527c8 sp=0xc000052778 pc=0x7b9585
emu/core.(*CZmqJsonRPC2).StartRxThread.func1()
	/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/core/rpc.go:105 +0x26 fp=0xc0000527e0 sp=0xc0000527c8 pc=0x7b9706
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:1571 +0x1 fp=0xc0000527e8 sp=0xc0000527e0 pc=0x466fe1
created by emu/core.(*CZmqJsonRPC2).StartRxThread
	/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/core/rpc.go:105 +0x56

goroutine 1 [running]:
	goroutine running on other thread; stack unavailable

goroutine 10 [IO wait]:
internal/poll.runtime_pollWait(0x7f93d8723ad8, 0x72)
	/usr/local/go/src/runtime/netpoll.go:302 +0x89
internal/poll.(*pollDesc).wait(0xc0004da600?, 0xc0005b3000?, 0x0)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:83 +0x32
internal/poll.(*pollDesc).waitRead(...)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:88
internal/poll.(*FD).Read(0xc0004da600, {0xc0005b3000, 0x1000, 0x1000})
	/usr/local/go/src/internal/poll/fd_unix.go:167 +0x25a
net.(*netFD).Read(0xc0004da600, {0xc0005b3000?, 0x0?, 0x4?})
	/usr/local/go/src/net/fd_posix.go:55 +0x29
net.(*conn).Read(0xc0001300b0, {0xc0005b3000?, 0x0?, 0x0?})
	/usr/local/go/src/net/net.go:183 +0x45
net/http.(*persistConn).Read(0xc00012c240, {0xc0005b3000?, 0x44a5c0?, 0xc000064ec8?})
	/usr/local/go/src/net/http/transport.go:1929 +0x4e
bufio.(*Reader).fill(0xc0005a06c0)
	/usr/local/go/src/bufio/bufio.go:106 +0x103
bufio.(*Reader).Peek(0xc0005a06c0, 0x1)
	/usr/local/go/src/bufio/bufio.go:144 +0x5d
net/http.(*persistConn).readLoop(0xc00012c240)
	/usr/local/go/src/net/http/transport.go:2093 +0x1ac
created by net/http.(*Transport).dialConn
	/usr/local/go/src/net/http/transport.go:1750 +0x173e

goroutine 11 [select]:
net/http.(*persistConn).writeLoop(0xc00012c240)
	/usr/local/go/src/net/http/transport.go:2392 +0xf5
created by net/http.(*Transport).dialConn
	/usr/local/go/src/net/http/transport.go:1751 +0x1791

goroutine 23 [chan receive]:
emu/core.(*NonBlockingChan).Read(0xc0000001e0?, 0x0?)
	/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/core/non_blocking_chan.go:134 +0x2f
emu/plugins/ipfix.(*FileExporter).cmdThread(0xc0000001e0)
	/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/plugins/ipfix/ipfix_file_exporter.go:479 +0x76
created by emu/plugins/ipfix.NewFileExporter
	/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/plugins/ipfix/ipfix_file_exporter.go:205 +0x46b

goroutine 24 [select]:
emu/plugins/ipfix.(*HttpExporter).observerThread(0xc0002aa200)
	/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/plugins/ipfix/ipfix_http_exporter.go:499 +0x29e
created by emu/plugins/ipfix.NewHttpExporter
	/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/plugins/ipfix/ipfix_http_exporter.go:206 +0x52a

rax    0x0
rbx    0x7f93d0ff9700
rcx    0x7f94007ad00b
rdx    0x0
rdi    0x2
rsi    0x7f93d0ff8a40
rbp    0x1
rsp    0x7f93d0ff8a40
r8     0x0
r9     0x7f93d0ff8a40
r10    0x8
r11    0x246
r12    0xffffffff
r13    0x2c01e78
r14    0x7f93d0ff9678
r15    0x2c01c18
rip    0x7f94007ad00b
rflags 0x246
cs     0x33
fs     0x0
gs     0x0

IP fragmentation support

We have noticed that trex-emu doesn't support fragmentation of large UDP packets (received or sent via transport) and since we need it we would like to help out, i.e contribute with the code changes and tests.
Is this something that would be accepted?

I have not seen the reasons for this design choice but would be happy for any information or reasoning why it's lacking.

RPC connection errors with dummy-veth

When starting EMU with dummy-veth flag, we can connect to the EMU server only once.
After the first connection, the EMU server generates an RPC error.

How to generate:

  1. start EMU with dummy-veth and with verbose mode (verbose mode so we can see the RPC requests and responses)
./trex-emu --dummy-veth -v
  1. start trex-console with emu-only-server flag (the first attempt)
./trex-console --emu-only-server
  1. stop trex-console

  2. start trex-console with emu-only-server flag (second attempt)

./trex-console --emu-only-server

trex-emu output:
trex-emu

trex-console output:
trex-emu-console

You can see that the first connection succeeded but the second connection failed.

cannot find package "github.com/akamensky/argparse" in any of:

################
when i install trex-emu Encountered the following problems
Are there any steps missing

log

root@dperf:/trex-emu/src# go install -v cmd/trex-emu.go
cmd/trex-emu.go:18:2: cannot find package "github.com/akamensky/argparse" in any of:
/usr/lib/go-1.10/src/github.com/akamensky/argparse (from $GOROOT)
/root/trex-emu/src/github.com/akamensky/argparse (from $GOPATH)
external/osamingo/jsonrpc/debug.go:7:2: cannot find package "github.com/alecthom as/jsonschema" in any of:
/usr/lib/go-1.10/src/github.com/alecthomas/jsonschema (from $GOROOT)
/root/trex-emu/src/github.com/alecthomas/jsonschema (from $GOPATH)
emu/core/thread_ctx.go:13:2: cannot find package "github.com/go-playground/valid ator" in any of:
/usr/lib/go-1.10/src/github.com/go-playground/validator (from $GOROOT)
/root/trex-emu/src/github.com/go-playground/validator (from $GOPATH)
external/osamingo/jsonrpc/context.go:6:2: cannot find package "github.com/intel- go/fastjson" in any of:
/usr/lib/go-1.10/src/github.com/intel-go/fastjson (from $GOROOT)
/root/trex-emu/src/github.com/intel-go/fastjson (from $GOPATH)
emu/plugins/appsim/appsim_schema.go:13:2: cannot find package "github.com/xeipuu v/gojsonschema" in any of:
/usr/lib/go-1.10/src/github.com/xeipuuv/gojsonschema (from $GOROOT)
/root/trex-emu/src/github.com/xeipuuv/gojsonschema (from $GOPATH)
emu/plugins/dot1x/mschapv2.go:27:2: cannot find package "golang.org/x/crypto/md4 " in any of:
/usr/lib/go-1.10/src/golang.org/x/crypto/md4 (from $GOROOT)
/root/trex-emu/src/golang.org/x/crypto/md4 (from $GOPATH)
root@dperf:
/trex-emu/src#

IPv6 parser unable to find RA option if preceded by PadN

Reading the IPv6 parser code, looks like it’s expecting the RA option 2 bytes after the Hop-by-Hop header start.

     802  if p[l4+2] == 0x5 {
     803       // rounter alert
     804       ps.Flags |= IPV6_M_RTALERT_ML
     805  }

However, the NXOS MLD packet is inserting a 2-byte padding before the RA option, so it is actually 4-bytes into the header as follows:

    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |  Next Header  |  Hdr Ext Len  |          PadN option          |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                          RA option                            |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

The parser logic should first check the option code and skip any PadN or Pad1 options until it reaches the RA option.

DHCP Request client packets will have invalid checksum

Accidentally, the checksum for DHCP Requests in case packets is written in the Discover (wrong) packet template.

For example here:

binary.BigEndian.PutUint16(d[26:28], cs)

it should be

binary.BigEndian.PutUint16(dr[26:28], cs)

instead of

binary.BigEndian.PutUint16(d[26:28], cs)

Should be fixed also here:

binary.BigEndian.PutUint16(d[26:28], cs)

EMU crash: runtime error: invalid memory address or nil pointer dereference

trex-emu crashes sometimes when we run it with kernel mode.

output:

./trex-emu -k
Run ZMQ server on [RPC:4500, RX: IPC, TX:IPC]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x7c1fae]

goroutine 1 [running]:
emu/core.(*cHTimerBucket).decCount(...)
	/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/core/timerw.go:130
emu/core.(*CHTimerObj).detach(...)
	/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/core/timerw.go:176
emu/core.(*cHTimerOneWheel).popEvent(0xc000455780?)
	/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/core/timerw.go:320 +0x2e
emu/core.(*CNATimerWheel).onTickLevel0(0xc0000b4840)
	/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/core/timerw.go:423 +0x65
emu/core.(*CNATimerWheel).OnTick(0xc0000b4840, 0x32d070?)
	/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/core/timerw.go:533 +0x32
emu/core.(*TimerCtx).HandleTicks(0xc00026d5f0)
	/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/core/timer_ctx.go:113 +0x2e
emu/core.(*CThreadCtx).MainLoop(0xc000324000)
	/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/core/thread_ctx.go:391 +0x185
main.RunCoreZmq(0xc00007e480)
	/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/cmd/trex-emu.go:183 +0x48c
main.main()
	/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/cmd/trex-emu.go:191 +0x1e

crash with igmp in client object and non in ns object

This solve the issue, need to make the ns object in anycase

diff --git a/scripts/emu/simple_emu.py b/scripts/emu/simple_emu.py
index 8f0191313..a3ba0f723 100644
--- a/scripts/emu/simple_emu.py
+++ b/scripts/emu/simple_emu.py
@@ -4,7 +4,8 @@ import argparse
 
 class Prof1():
     def __init__(self):
-        self.def_ns_plugs  = None
+        self.mac = Mac('00:00:00:70:00:01')
+        self.def_ns_plugs  = {'igmp' : {'dmac':self.mac.V()}} 
         self.def_c_plugs  = {'arp': {'timer': 50},
                              'igmp': {},
                             }

download the latest package

Hello,
I wanted to do the emu test with a proxy (5.3. Proxy > 5.3.1. Intro)
I had this error:
root@t-rex1:/home/trex-emu-2.84/scripts# go install cmd-proxy/trex-emu-proxy.go stat cmd-proxy/trex-emu-proxy.go: no such file or directory
Is there a way to download the pre built package without building from source ?

trex-emu socket creation

Hi!

I´m trying to develop an emu plugin for GTP traffic. The plugin itself creates the session request packets, sends them to the DUT and gets the responses to process the packets.

The main issue and reason for this post is that the response packets are not getting forwarded from the trex-core back to the trex-emu. I´ve used the example 7.2 Transport layer and also the transport_example plugin provided with the code since the traffic we want to be sent to emu (GTP create session response) is UDP with src and dst ports 2123.

I made some captures to check the route of the packets, one in the zmq channel between emu and core and one in each of the tx and rx ports of the core also. As expected, the requests packets reach the DUT and create the sessions and the responses come back to the server. Once here, the responses are not getting forwarded to emu and I suspect it is because my implementation of the socket creation on my plugin.

This is a part of the capture done in the rx of the core with one of the packets I want to be forwarded to trex-emu. The 5.0.0.1 is the DUT IP and the 6.12.0.X are the clients IPs.

My first approach was to create a socket for each emu client so I added this "createSocketPerClient" function to the OnEvent callback.

    func (o *PluginGtpcClient) OnEvent(msg string, a, b interface{}) {
    
        f, _ := os.OpenFile("trace.log", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
    
        switch msg {
        case core.MSG_DG_MAC_RESOLVED:
	        bitMask, ok := a.(uint8)
	        if !ok {
		        // failed at type assertion
		        return
	        }
    
	        resolvedIPv4 := (bitMask & core.RESOLVED_IPV4_DG_MAC) == core.RESOLVED_IPV4_DG_MAC
	        if resolvedIPv4 {
		        myIPv4 := o.Client.Ipv4
		        if myIPv4[0] == 11 && myIPv4[1] == 0 {
			        return
		        }
		        f.WriteString("Going to create a socket\n")
		        o.createSocketPerClient() //Prepares and creates the socket
    
		        o.sendGtpcCSRPacket() //Send the connection request
		        o.startTimer() //Periodical timer to send echo requests
	        }
        }
    }

The socket created is "clientIP:2123" for UDP traffic

    func (o *PluginGtpcClient) createSocketPerClient() {
    
        f, _ := os.OpenFile("trace.log", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
        f.WriteString("\tAcquiring the transport ctx\n")
    
        o.ctx = transport.GetTransportCtx(o.Client) //Get the plugin or thread ctx?
    
        clientIP := o.Client.Ipv4
        var gtpPort = "2123"
        var clientIPby = net.IPv4(clientIP[0], clientIP[1], clientIP[2], clientIP[3])
        var socket = clientIPby.String() + ":" + gtpPort
    
        f.WriteString("\tDialing socket: " + socket + "\n")
    
        s, err := o.ctx.Dial("udp", socket, o, nil, nil, 2123)
        if err != nil {
	        f.WriteString("\tERROR creating the socket \n")
	        return
        }
        o.s = s
        f.WriteString("\tSocket " + s.LocalAddr().String() + " created succesfully --> LOCAL \n")
        f.WriteString("\tSocket " + s.RemoteAddr().String() + " created succesfully --> REMOTE\n\n")
    }

I put this log messages to check the creation process and as shown here for example, it seems correct, there isn´t any error and it gets to the end.

Going to create a socket
        Acquiring the transport ctx
        Dialing socket: 6.12.0.11:2123
        Socket 6.12.0.11:2123 created succesfully --> LOCAL
        Socket 6.12.0.11:2123 created succesfully --> REMOTE

I´ve implemented the rest of the callbacks (OnRxEvent, OnRxData and OnTxEvent) also with log messages just for debugging purpose but as said before, the packets aren´t reaching emu, that´s why I think the problem is in the socket creation.

I don´t know if this approach of having one socket per client is viable or if is there a way to create a generic socket for all traffic coming to 2123 port (some kind of 0.0.0.0:2123). Without anything else to add, I appreciate any help. Thanks!

No Error in case of used RPC-Port

There is no error msg in case we run EMU with an already taken port.
In this case, the EMU process will seem to be working fine, but the RPC request will not be able to reach the EMU process.

The EMU process should print an error msg, in such cases, specify that the RPC port is already taken, and exit.

How to generate:

  1. run program that listens to EMU's RPC-Port (default to port 4510).
-bash-4.2$ lsof -i :4510
COMMAND    PID    USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
using_por 5711 syaakov    8u  IPv6 586466      0t0  TCP *:4510 (LISTEN)

You can see that indeed there is a process that listens to the 4510 port.

  1. run the EMU (by default the emu listens to 4510 port).
-bash-4.2$ ./trex-emu -v
Run ZMQ server on [RPC:4510, RX: IPC, TX:IPC]

You can see that there is no error msg even though there is another process listening to port 4510.

You can see that this process is still listening to this port.

-bash-4.2$ lsof -i :4510
COMMAND    PID    USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
using_por 5711 syaakov    8u  IPv6 586466      0t0  TCP *:4510 (LISTEN)

Now of course if we try to connect to the EMU using RPC it would fail.

-bash-4.2$ ./trex-console --emu-only-server

Using Python3 as Python interpeter


Server Info:

Server version:   v0.1 @ Dummy
Server mode:      Dummy Mode
Server CPU:       N/A x N/A
Ports count:

Connecting to RPC server on localhost:4510                   [FAILED]


Loading plugin: emu                                          [FAILED]

Could not run "plugin_load()" of plugin "emu", error: *** [RPC] - Failed to get server response from tcp://localhost:4510

-=TRex Console v3.0=-

Type 'help' or '?' for supported actions

emu>

issue with build

root@t-rex1:/home/trex-emu-2.84/src# go install -v cmd/trex-emu.go
cmd/trex-emu.go:14:2: cannot find package "github.com/akamensky/argparse" in any of:
/usr/lib/go-1.10/src/github.com/akamensky/argparse (from $GOROOT)
/home/trex-emu-2.84/src/github.com/akamensky/argparse (from $GOPATH)
external/osamingo/jsonrpc/debug.go:7:2: cannot find package "github.com/alecthomas/jsonschema" in any of:
/usr/lib/go-1.10/src/github.com/alecthomas/jsonschema (from $GOROOT)
/home/trex-emu-2.84/src/github.com/alecthomas/jsonschema (from $GOPATH)
emu/core/thread_ctx.go:13:2: cannot find package "github.com/go-playground/validator" in any of:
/usr/lib/go-1.10/src/github.com/go-playground/validator (from $GOROOT)
/home/trex-emu-2.84/src/github.com/go-playground/validator (from $GOPATH)
external/osamingo/jsonrpc/context.go:6:2: cannot find package "github.com/intel-go/fastjson" in any of:
/usr/lib/go-1.10/src/github.com/intel-go/fastjson (from $GOROOT)
/home/trex-emu-2.84/src/github.com/intel-go/fastjson (from $GOPATH)
emu/plugins/dot1x/mschapv2.go:27:2: cannot find package "golang.org/x/crypto/md4" in any of:
/usr/lib/go-1.10/src/golang.org/x/crypto/md4 (from $GOROOT)
/home/trex-emu-2.84/src/golang.org/x/crypto/md4 (from $GOPATH)
root@t-rex1:/home/trex-emu-2.84/src# cd ..
root@t-rex1:/home/trex-emu-2.84# ls
CONTRIBUTING.md CONTRIBUTORS LICENSE README.asciidoc VERSION doc external_share scripts src unit-test
root@t-rex1:/home/trex-emu-2.84# cd scripts/
root@t-rex1:/home/trex-emu-2.84/scripts# ./utility_script build -v
cmd/trex-emu.go:14:2: cannot find package "github.com/akamensky/argparse" in any of:
/usr/lib/go-1.10/src/github.com/akamensky/argparse (from $GOROOT)
/home/trex-emu-2.84/src/github.com/akamensky/argparse (from $GOPATH)
external/osamingo/jsonrpc/debug.go:7:2: cannot find package "github.com/alecthomas/jsonschema" in any of:
/usr/lib/go-1.10/src/github.com/alecthomas/jsonschema (from $GOROOT)
/home/trex-emu-2.84/src/github.com/alecthomas/jsonschema (from $GOPATH)
emu/core/thread_ctx.go:13:2: cannot find package "github.com/go-playground/validator" in any of:
/usr/lib/go-1.10/src/github.com/go-playground/validator (from $GOROOT)
/home/trex-emu-2.84/src/github.com/go-playground/validator (from $GOPATH)
external/osamingo/jsonrpc/context.go:6:2: cannot find package "github.com/intel-go/fastjson" in any of:
/usr/lib/go-1.10/src/github.com/intel-go/fastjson (from $GOROOT)
/home/trex-emu-2.84/src/github.com/intel-go/fastjson (from $GOPATH)
emu/plugins/dot1x/mschapv2.go:27:2: cannot find package "golang.org/x/crypto/md4" in any of:
/usr/lib/go-1.10/src/golang.org/x/crypto/md4 (from $GOROOT)
/home/trex-emu-2.84/src/golang.org/x/crypto/md4 (from $GOPATH)

Emu crash: panic: counter can't be zero

trex-emu crashes when we run it with kernel-mode, with the error message: panic: counter can't be zero

output:

./trex-emu -k
Run ZMQ server on [RPC:4510, RX: IPC, TX:IPC]
panic: counter can't be zero

goroutine 1 [running]:
emu/core.(*cHTimerBucket).decCount(...)
/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/core/timerw.go:131
emu/core.(*CHTimerObj).detach(...)
/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/core/timerw.go:176
emu/core.(*cHTimerOneWheel).stop(...)
/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/core/timerw.go:294
emu/core.(*CNATimerWheel).Stop(0x895946?, 0xc0001c01d8?)
/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/core/timerw.go:542 +0xfb
emu/core.(*TimerCtx).Stop(...)
/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/core/timer_ctx.go:81
emu/plugins/arp.(*ArpFlowTable).MoveToLearn(0xc0000b41a0, 0xc00034a480)
/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/plugins/arp/arp.go:411 +0x45
emu/plugins/arp.(*PluginArpNs).DisassociateClient(0xc0000b4160, 0xc0000e61e0, {0x1, 0x1, 0x1, 0x1})
/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/plugins/arp/arp.go:843 +0xd8
emu/plugins/arp.(*PluginArpClient).OnChangeDGSrcIPv4(0xc0000e61e0, {0x1, 0x1, 0x1, 0x1}, {0x1, 0x1, 0x1, 0x1}, 0xbd?, ...)
/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/plugins/arp/arp.go:714 +0x59
emu/plugins/arp.(*PluginArpClient).OnRemove(0xc0000e61e0, 0xc0002fcb70)
/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/plugins/arp/arp.go:728 +0x93
emu/core.(*PluginCtx).RemovePlugins(0xc0002fcb70, {0xc00024cfe8, 0x3})
/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/core/plugin_ctx.go:224 +0x86
emu/core.(*PluginCtx).OnRemove(...)
/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/core/plugin_ctx.go:171
emu/core.(*CClient).OnRemove(0x953180)
/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/core/client_ctx.go:200 +0xb8
emu/core.(*CNSCtx).RemoveClient(0xc0002086c0, 0xc000192200)
/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/core/ns_ctx.go:393 +0x139
emu/core.ApiClientRemoveHandler.ServeJSONRPC({}, {0x9e3800?, 0xc00022a000?}, 0xc0002ac650?)
/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/core/rpc_base_cmds.go:397 +0x173
external/osamingo/jsonrpc.(*MethodRepository).InvokeMethod(0xc0002aa280, {0xba?, 0x200?}, 0xc000842060)
/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/external/osamingo/jsonrpc/handler.go:135 +0x202
external/osamingo/jsonrpc.(*MethodRepository).ServeBytes(0xc0002aa280, {0xc000340000, 0xba, 0x200})
/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/external/osamingo/jsonrpc/handler.go:53 +0x3e8
external/osamingo/jsonrpc.(*MethodRepository).ServeBytesCompress(0xc00006be10?, {0xc00033e000?, 0x410d25?, 0x0?})
/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/external/osamingo/jsonrpc/handler.go:77 +0x65
emu/core.(*CZmqJsonRPC2).HandleReqToChan(...)
/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/core/rpc.go:116
emu/core.(*CThreadCtx).MainLoop(0xc00022a000)
/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/emu/core/thread_ctx.go:389 +0x147
main.RunCoreZmq(0xc00007e480)
/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/cmd/trex-emu.go:183 +0x48c
main.main()
/tmp/build_838_TRex_Emu_1d2de09906f0266741b2c59c2f9e2c6fa287b809/src/cmd/trex-emu.go:191 +0x1e

SendBuffer doesn't resolve IPv4 Default Gateway correctly

The

func (o *VethIFZmq) SendBuffer(unicast bool, c *CClient, b []byte) {
method doesn't account for forced Default Gateway and resolves incorrectly. It also doesn't account for IPv6.

It should use

func (o *CClient) ResolveIPv4DGMac() (mac MACKey, ok bool) {
to resolve IPv4 default gateway and
func (o *CClient) ResolveIPv6DGMac() (mac MACKey, ok bool) {
to resolve IPv6 default gateway.

Also, since it can't know which Default Gateway to use (Ipv4 or Ipv6) unless it parses the packet, it should probably receive a boolean flag that indicates if this is IPv6.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.