problem in getting mac address using arpresolve - VxWorks

This is a discussion on problem in getting mac address using arpresolve - VxWorks ; Hi, I am using the if_output function of the mottsec interface for sending the IP packets to the End Driver. The following is sample program: M_BLK_ID pMblk; bool PktSend(UINT8* buffer,int size) { struct ifnet* inet; struct ip * iph; unsigned ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: problem in getting mac address using arpresolve

  1. problem in getting mac address using arpresolve

    Hi,

    I am using the if_output function of the mottsec interface for sending
    the IP packets to the End Driver.

    The following is sample program:

    M_BLK_ID pMblk;

    bool PktSend(UINT8* buffer,int size)
    {
    struct ifnet* inet;
    struct ip * iph;
    unsigned char ipAddr [30];
    struct sockaddr_in sin;

    iph = (struct ip*) buffer;

    inet_ntoa_b (iph -> ip_dst, (char*) ipAddr);

    printf(" \n Dest Mac Ip : %s \n",ipAddr);

    inet = ifunit("mottsec0");

    sin.sin_len = sizeof(struct sockaddr_in);
    sin.sin_family = AF_INET;
    sin.sin_addr.s_addr = inet_addr((char*)ipAddr);

    if ((pMblk = netMblkGet(pNetPool,M_WAIT,1)) == NULL)
    {
    printf("\n Failed to get mBlk 1 \n");
    return FALSE;
    }

    if (netMblkClGet(pNetPool,pMblk,size,M_WAIT,TRUE) != OK)
    {
    printf("\n pMblk: Connecting the clBlk and cluster pair to mBlk
    Failed \n");
    return FALSE;
    }

    memcpy (pMblk->mBlkHdr.mData, (char *) buffer, size);
    pMblk -> mBlkHdr.mLen = size;

    if (inet->if_output (inet,(struct mbuf*) pMblk,(struct sockaddr*)
    &sin, NULL) == OK)
    {
    printf("\n Packet is sent successfully \n");
    }
    else
    {
    printf("\n Packet is Dropped by the ipOutput \n");
    }

    I have the following routes in the routing table:

    ROUTE NET TABLE
    destination gateway flags Refcnt Use
    Interface
    ----------------------------------------------------------------------------
    0.0.0.0 172.20.214.1 33619971 0 0
    mottsec0
    172.20.214.0 172.20.215.215 33554689 1 0
    mottsec0
    ----------------------------------------------------------------------------

    ROUTE HOST TABLE
    destination gateway flags Refcnt Use
    Interface
    ----------------------------------------------------------------------------
    127.0.0.1 127.0.0.1 35651589 0 0
    lo0
    ----------------------------------------------------------------------------

    In this scenorio when i am sending the IP packet to 172.20.215.34
    things are working fine.

    If i add a route as follows:

    routec "add -net 172.20.215.34 172.20.214.250 -netmask
    255.255.255.255". In 172.20.214.250 routing is enabled.

    Route Table:

    ROUTE NET TABLE
    destination gateway flags Refcnt Use
    Interface
    ----------------------------------------------------------------------------
    0.0.0.0 172.20.214.1 33619971 0 0
    mottsec0
    172.20.214.0 172.20.215.215 33554689 2 0
    mottsec0
    172.20.215.34 172.20.214.250 33556483 0 0
    mottsec0
    ----------------------------------------------------------------------------

    ROUTE HOST TABLE
    destination gateway flags Refcnt Use
    Interface
    ----------------------------------------------------------------------------
    127.0.0.1 127.0.0.1 35651589 0 0
    lo0
    ----------------------------------------------------------------------------

    When i am sending packet to 172.20.215.34, packet send is failing due
    to arpresolve is not resolving the MAC address of 172.20.214.250.

    when i am pinging 172.20.215.34 from the vxworks shell i could able to
    get the response and i could be able to see the arp entry for the
    172.20.214.250 in arp table.

    Now my question is :

    1) Is there anything wrong with this kind of routing configuration?.
    2) If not, how to send packets in this configuration?.
    3) Is there any function to get the routing entry with the highest mask
    in vxworks?.

    Regards,
    Firoz.


  2. Re: problem in getting mac address using arpresolve

    Hi,
    I think there is a problem of configuring the Default Router for the
    Interfaces.

    See the scenario should be like this

    VxWorks <-->(IP-A) Router (IP-B)<--> Remote Interface

    for VxWorks the default gateway should be set as IP-A
    and for the remote interface the default gateway should be set as IP-B.
    unless this is done, your routing won't work.

    Cheers,
    Raj


+ Reply to Thread