Here is the part of code where I attempt to listen for icmp packet in a 
namespace. The same code is used for IPv4 and IPv6, only proto and scr are 
differ depending on ipv4 or ipv6 mode.
For IPv4 address code work as expected but for IPv6 ListenPacket fails.

                org, err := netns.Get()
                if err != nil {
                                return err
                defer netns.Set(org)
                if err := netns.Set(sourceNS); err != nil {
                                return err

                c, err := icmp.ListenPacket(proto, src)
                if err != nil {
                                return fmt.Errorf("call ListenPacket failed 
with error: %+v", err)
                defer c.Close()

ListenPacket fails with: “call ListenPacket failed with error: listen 
ip6:ipv6-icmp 2001:1::1: bind: cannot assign requested address”

Here is how proto and src looks like for IPv6:

Proto: ip6:ipv6-icmp Address: 2001:1::1

I confirmed that namespace has veth interface with right ipv6 address.

Links found in the namespace, as you can see ipv6 address I am trying to bind 
ListenPacket is present.

Link: lo
Link: veth-1-612de81e
- 2001:1::1

Appreciate some ideas what I do wrong for ipv6 case.
Thank you

You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

Reply via email to