8

I am developing a IPv6 linux device driver without the equipment at hand. So I am now trying to cheat the kernel with a fake router advertisement message.

unsigned char c[] = {0x33, 0x33, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 61, 0x86, 0xdd, //IPv6 type
            0x60, 0x00, 0x00, 0x00, //Version, ...
            0x00, 24, //payload length
            58,         //next header 
            255,        //hop limit 
            0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xff, 0xfe, 0x00, 0x00, 0x3d, //source
            0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //destination
            134, //type
            0, //code,
            0x7a, 0x2c, //checksum
            255, //current hop limit
            0x80, //flag
            0xff, 0xff,
            0x00, 0x00, 0x00, 0x00, //reachable timer
            0x00, 0x00, 0x00, 0x00,
            0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 61, //source link-layer address   
            };

I tried to use Tcpdump to grab this packet I send to the kernel. And I found that the kernel really get this packet.

13:32:59.989851 00:00:00:00:00:3d (oui Ethernet) > 33:33:00:00:00:02 (oui Unknown), ethertype IPv6 (0x86dd), length 78: (hlim 255, next-header ICMPv6 (58) payload length: 24) fe80::200:ff:fe00:3d > ip6-allnodes: [icmp6 sum ok] ICMP6, router advertisement, length 24
    hop limit 255, Flags [managed], pref medium, router lifetime 65535s, reachable time 0s, retrans time 0s
      source link-address option (1), length 8 (1): 00:00:00:00:00:3d
        0x0000:  0000 0000 003d

But after that I use ip -6 neigh to examine whether the kernel have the fake node in the neighbor table. I cannot find it.

What is my problem? Any idea?

Yifan Sun
  • 772
  • 1
  • 10
  • 25
  • This seems like a pretty specialist problem; i suspect you will get much better answers somewhere like the [netdev mailing list](http://www.spinics.net/lists/netdev/) than StackOverflow. – Tom Anderson Feb 09 '13 at 01:07
  • Out of interest, though, what is an "IPv6 linux device driver"? Why does the fact that IPv6 is in use impinge on the device driver? – Tom Anderson Feb 09 '13 at 01:08
  • @TomAnderson: This was also asked on [a previous question by Yifan Sun](http://stackoverflow.com/questions/14760301/linux-device-driver-for-pure-ipv6-device). It hasn't been adequately answered -- it sounds like they're trying to write a driver which refuses to support IPv4 packets??! –  Feb 09 '13 at 01:39
  • 1
    @TomAndersonThank you guys for your concern. The problem is solved. I am sending a router advertisement, and I can find it by typing "ip -6 route" rather than "ip -6 neigh". Thanks again. – Yifan Sun Feb 09 '13 at 04:53
  • @duskwuff: Weird stuff, man. – Tom Anderson Feb 09 '13 at 10:27
  • Check the setup on the receiving machine. It is may be configured to ignore RA. For instance on Linux, check the sysctl parameters net.ipv6.conf.$DEVICE.accept_ra – bortzmeyer Feb 09 '13 at 22:01

2 Answers2

1

Why fake a router advertisement ?

What I would do in your situation is put a 2nd Linux on the same Ethernet link (in VMWare or any other virtual environment if you do not have a physical setup), install radvd on this 2nd Linux, and let radvd send router advertisement on the link.

jfg956
  • 16,077
  • 4
  • 26
  • 34
1

Perhaps these hacking toolkits will be helpful

  1. IPv6-toolkit - the ra6 program fakes router advertisements
  2. THV-IPv6 - the *fake_advertise6* program
Bruce Barnett
  • 904
  • 5
  • 11