Find the answer to your Linux question:
Results 1 to 2 of 2
Hi geeks, I was try to write a socket function which will alter the hoplimit of a IPV6 packet dynamically via setsockopt(). Below are my analysis related to setting hoplimit ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2013
    Posts
    5

    Question Dynamic IPV6 hoplimit set


    Hi geeks,
    I was try to write a socket function which will alter the hoplimit of a IPV6 packet dynamically via setsockopt().
    Below are my analysis related to setting hoplimit for ipv4 and ipv6
    1. During the creation of socket we can specify the hoplimit by using setsockopt.
    Code:
    udp_create_ipv6_socket (dum, &sock,DEFAULT_PORT_UDP_SRC, PACKET_WRITE);
    pal_sock_set_ipv6_unicast_hops (sock,dist_ttl);
    2. This is the TTL value being set during the creation of socket and im trying to change the value dynamically based on user input
    Code:
    pal_sock_set_ipv6_unicast_hops (sock,dyna_ttl);
    3. But it is not working as expected. I was able to set the hoplimit of IPV6 packet just once only if I try to modify the same it fails. Please help me code in way that dynamic TTL can be set for the socket.

    P.S code for pal_sock_set_ipv6_unicast_hops
    Code:
    pal_sock_set_ipv6_unicast_hops (pal_sock_handle_t sock, s_int32_t hops)
    {
      return setsockopt (sock, PAL_IPPROTO_IPV6, IPV6_UNICAST_HOPS, &hops,
                         sizeof (hops));
    }

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,572
    Please do not double-post. It is bad forum etiquette, and not allowed by the forum rules.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •