Ipv6 multicast sending problem

541 views
Skip to first unread message

Samvel

unread,
Sep 4, 2015, 4:59:07 AM9/4/15
to ns-3-users
        Hello ns-3-users community. I had some problem with realization of "broadcast imitation" in Ipv6 using wifi. I'm trying to use Inet6SocketAddress, but it dont want to send on multicast addresses like ("FF02::2") or others, return error: .<< assert failed. cond="interface", msg="Try to send on link-local multicast address, and no interface index is given!", file=../src/internet/model/ipv6-static-routing.cc, line=292
terminate called without an active exception
Command ['/home/samvel/programs2/ns-allinone-3.23/ns-3.23/build/scratch/leachv6', '--SimulatorImplementationType=ns3::VisualSimulatorImpl'] terminated with signal SIGIOT. Run it under a debugger to get more information (./waf --run <program> --command-template="gdb --args %s <args>").
>>

     However, as i understood that addreses is Link-state, so i dont understand why its not working. It lookes like need some magic to let it work, but i'm not sure what to do, how let it fly.. Please someone advice how to fix it..

Attached code .. 



Ipv6WifiTest.cc

Tommaso Pecorella

unread,
Sep 4, 2015, 9:15:08 AM9/4/15
to ns-3-users
Hi,

the only magic thing here is how I figured out what you meant to ask. Please take your time to explain your problem in a simple and clear way next time, or the chances to be simply ignored will skyrocket.

Let's recap. You want to send a packet to a link-local multicast address.
You have a socket opened, it's an UDP socket and it is connected (!) to a global address (hopefully, it's not guaranteed).

Now, you have to understand two main things:
1) UDP is a connectionless protocol. The "Connect" function is there just as a nice shortcut to allow to use a simpler "Send". Consider it a shortcut - you instruct the UDP socket to send the packets to a given address unless stated otherwise (by using SendTo).
2) Link-local address are valid for all the interfaces. Any interface will have a link-local address.

Point 2 in particular is relevant for you. If you send a packet to a link-local address (any link-local address, multicast or unicast), the routing protocol is NOT able to decide what is the best interface to send the packet to. As a consequence, in order to send a packet to a link-local address, you MUST use a socket previously bound to a specific interface, i.e., you must use BindToNetDevice.

The only thing I can agree on is that the error message is a bit cryptic, we'll improve it.

Have fun,

T.

Samvel

unread,
Sep 5, 2015, 3:06:01 AM9/5/15
to ns-3-users
           Oh, sorry for bad explanation, next time will try to explain problem clear. And thank u very much for ur quick and useful answer. 

          Respectfully, Samvel. 

пятница, 4 сентября 2015 г., 21:15:08 UTC+8 пользователь Tommaso Pecorella написал:

Samvel

unread,
Sep 9, 2015, 10:28:48 PM9/9/15
to ns-3-users
        Hi, its again me. Maybe previous question was stupid enough, but it lookes like the new one isnt much clever. I'm trying to do the same thing with SixLowPan using Udp Inet6Socket for connecting. So I have 4 nodes, one is source, others are listening. When i send to one of them it catch Recvcallback, however multicast isnt cathing by anyone. I dont know what the problem, please suggest smth if u have ideas about it.. 

Attached code..

пятница, 4 сентября 2015 г., 21:15:08 UTC+8 пользователь Tommaso Pecorella написал:
Hi,
sixlowtest.txt

Tommaso Pecorella

unread,
Sep 10, 2015, 9:34:49 AM9/10/15
to ns-3-users
Hi,

perhaps binding the socket to the right address will help...
You wrote:
  Inet6SocketAddress sinkAdr = Inet6SocketAddress (deviceInterfaces.GetAddress(i,1), port);
instead of
  Inet6SocketAddress sinkAdr = Inet6SocketAddress (Ipv6Address("FF02::2"), port);

Feel free to Doh'.

Cheers,

T.

PS: yes, you can bind a socket to ANY address, even the ones you don't have. The point is: a multicast packet will reach L3 and will be dispatched to L4 (UDP in this case), while if you try to bind a socket to a unicast address you don't own, the packet will be filtered by L3.

Cheers,

T.

Samvel

unread,
Sep 10, 2015, 10:04:56 AM9/10/15
to ns-3-users
            Thank u again, Master! But if u not mind, i want to make it clear for me. So if I want to let my nodes catch not only multicast messages, but also unicast, i need to add for each nodes 2 socket's ( one for multicast and one for unicast )? Just it sounds like "dirty" way, maybe there are some other ways to out.. ? 

четверг, 10 сентября 2015 г., 21:34:49 UTC+8 пользователь Tommaso Pecorella написал:

Tommaso Pecorella

unread,
Sep 10, 2015, 1:05:53 PM9/10/15
to ns-3-users
Hi,

yes, you have to use 2 sockets, and no, it's not the dirty way, it's the only way... you'd do in this way also in a real system :)
The only alternative is to open the socket on the "any" address, but THIS is the dirty way: you'd have to filter the packets in your own handler !

Cheers,

T.

Samvel

unread,
Sep 10, 2015, 10:18:27 PM9/10/15
to ns-3-users

      Ok, now i got it. U rly helped me a lot. Thank u so much for ur patience.

      Respectfully, Samvel.


пятница, 11 сентября 2015 г., 1:05:53 UTC+8 пользователь Tommaso Pecorella написал:
Reply all
Reply to author
Forward
0 new messages