-
Notifications
You must be signed in to change notification settings - Fork 711
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
example xdp: The IP address output by xdp demo is empty #1175
Comments
I can confirm that this is also broken for me.
|
cool! It worked for me, too! |
Feel free to open a PR with the fix @BillyChen1 |
The library has somewhat complicated semantics when unmarshaling map keys and values. It turns out that the following was supported (but not documented) until the zero-allocation marshaling work broke it: var s []byte m.Lookup(key, &s) The important thing is that the slice here is empty. The current code treats this as "the key should be zero length" while originally we'd assign the temporary buffer used by the syscall to s as a way to reduce allocations. In hindsight this wasn't a great idea, but it is what it is. Reintroduce the byte slice special case. Fixes cilium#1175 Signed-off-by: Lorenz Bauer <[email protected]>
The library has somewhat complicated semantics when unmarshaling map keys and values. It turns out that the following was supported (but not documented) until the zero-allocation marshaling work broke it: var s []byte m.Lookup(key, &s) The important thing is that the slice here is empty. The current code treats this as "the key should be zero length" while originally we'd assign the temporary buffer used by the syscall to s as a way to reduce allocations. In hindsight this wasn't a great idea, but it is what it is. Reintroduce the byte slice special case. Fixes cilium#1175 Signed-off-by: Lorenz Bauer <[email protected]>
Describe the bug
The IP address output by xdp demo is empty (NIL)
To Reproduce
Env:
Behavior:
Expected behavior
My expectation was to see the IP address string.
I found that if I use the uint32 type in
examples/xdp/main.go
to accept theval
attribute, and useinternal.NativeEndian.PutUint32
to convert it to a byte array, I can solve the problem.The following is my modification to the
formatMapContents
method inexamples/xdp/main.go
, which can solve this problem.After modification, the problem was solved.
The text was updated successfully, but these errors were encountered: