Search code examples
ccontikiiot

How to get packet info at Border Router Node?


I have made udp-server and udp-client communication via border router node. It able to communicate from client to server.

I have difficulty in how to get packet info like ... source IP, Destination IP at border router node?? I am able to get it at server node but how to get same thing in border router node?


Solution

  • When recieved by a router, a packet is routed by the function tcpip_ipv6_output, into file tcpip.c. You can activate PRINTFs of this file by setting the DEBUG macro to DEBUG_PRINT.

    In this function, you can get the source & destination addresses with UIP_IP_BUF->destipaddr and UIP_IP_BUF->srcipaddr. Check, for example, when the route to the destination is looked up in the routing table :

    uip_ds6_route_t *route;
    /* Check if we have a route to the destination address. */
    route = uip_ds6_route_lookup(&UIP_IP_BUF->destipaddr);