Setting IP of VLAN device (NDK and DM6437)

I'm working with a "hello world" code on DM6437. I need to create a VLAN and set an IP to this new "device". I can set the ip of eth0 and ping it.

I saw the chapter "A.16 Virtual LAN (VLAN) Support" in spru54_pg.pdf and I understand how i can create the device but I don't know how to set an IP.

I know It's possible in Linux. Is it possible in this platform? Any help?

  • Hi Simone Cilli,

    Which version of the NDK are you using?  Also which version of BIOS?

    Thanks,

    Steve

  • In reply to Steven Connell:

    NDK 2.0 and DSP/BIOS 5.31.02.

    Simone

  • In reply to Simone Cilli:

    Simone,

    Have you seen the NDK Client example?

    This example has VLAN built into it.  You don't need to configure an IP address as they will just be sent via the board's IP address.  The VLAN tagged packets carry a 16-bit tag also known as the tag control information (TCI) header, which I believe is used by the stack to identify which socket data should go to.

    You can use VLAN by first telneting into the board.  The 'vlan' command allows you to add/delete and send on a VLAN device:

    >vlan

    [vlan Command]

    Use this to add/del & configure VLAN Devices

    vlan add  <srcif> <vlan_id> <default prio>   - Adds a VLAN Device
    vlan del  <vlan_id_index>                    - Deletes a VLAN Device
    vlan send <dst_ip>                           - Tests SO_PRIORITY option by sending packets
    >
    >
    >
    >vlan add 1 2 5
    Successfully created new VLAN Device 2
    >
    >
    >
    >vlan send 146.252.161.73
    TEST Case Passed: Priority 0x8 is incorrect and was detected
    Packet with priority 0 has been sent
    Packet with priority 1 has been sent
    Packet with priority 2 has been sent
    Packet with priority 3 has been sent
    Packet with priority 4 has been sent
    Packet with priority 5 has been sent
    Packet with priority 6 has been sent
    Packet with priority 7 has been sent
    Packet with default priority has been sent

    Steve

  • In reply to Steven Connell:

    The problem is that my requirements said I have to use different IP for each VLAN on the same network interface....
    Can I conclude It is impossible to set different IPs on the VLANs on this board?!


    Anyway Thanks for your help!

    Simone

  • In reply to Simone Cilli:

    Following the example you suggest, we tried to modify the VLAN ip.
    We obtain this error:
    "BindNew: Duplicate bindings ignored"

    This is the code we apply to the vlan project (NDK 2.0):

    File convlan.c:

    static void CmdVLANAdd(char *tok1, char *tok2, char *tok3){
    mmZeroInit (&nimu_ifreq, sizeof(NIMU_IF_REQ));
    nimu_ifreq.index = vlan_dev_index;
        
       if (NIMUIoctl (NIMU_GET_DEVICE_HANDLE, &nimu_ifreq, &hIF_vlan1, sizeof(HANDLE)) < 0){
          ConPrintf ("NIMUIoctl error\n");
          return;
       }
     
       //If-1 ip: 192.168.0.144
      //If-1 subnet_mask: 255.255.255.0
    ipn = inet_addr(vlan1_ip); //vlan1_ip: 192.168.1.144
       ipmask = inet_addr(vlan1_sm); //vlan1_subnetmask: 255.255.255.0
       BindNew(hIF_vlan1, ipn, ipmask);
       NtIPN2Str(ipn, (char *)ip_str);    
       ConPrintf ("VLAN - set ip: %s\n", ip_str);
       return;
    }
  • In reply to Simone Cilli:

    Simone,

    I think what you need to do is first get 2 IP addresses working on a single interface.  Then, once you have that working, you should be able to configure VLAN for each one.

    Please see the following post in which a customer was able to do this, it may help you.  Note, however, that he had to make each IP address on a different sub net

    Steve

    http://e2e.ti.com/support/embedded/bios/f/355/t/168240.aspx#613886