btashton commented on a change in pull request #2415:
URL: https://github.com/apache/incubator-nuttx/pull/2415#discussion_r536575892



##########
File path: net/inet/ipv4_setsockopt.c
##########
@@ -184,16 +189,41 @@ int ipv4_setsockopt(FAR struct socket *psock, int option,
         }
         break;
 
-      /* The following IPv4 socket options are defined, but not implemented */
-
-      case IP_MULTICAST_IF:           /* Set local device for a multicast
-                                       * socket */
       case IP_MULTICAST_TTL:          /* Set/read the time-to-live value of
                                        * outgoing multicast packets */
+        {
+          if (psock->s_type != SOCK_DGRAM ||
+              value_len != sizeof(int))

Review comment:
       bsd and as well as tldp and ltp all use uchar
   ```
        The IP_MULTICAST_TTL option changes the time-to-live (TTL)      for 
outgoing
        multicast datagrams in order to control the scope of the multicasts:
   
        u_char ttl;     /*      range: 0 to 255, default = 1 */
        setsockopt(s, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl));
   ```
   The linux man 7 ip page is unfortunate because it seems to be playing loose 
with the word `integer`
   ```
          IP_MULTICAST_TTL (since Linux 1.2)
                 Set or read the time-to-live value of outgoing multicast pack‐
                 ets for this socket.  It is very important for multicast pack‐
                 ets to set the smallest TTL possible.  The default is 1 which
                 means that multicast packets don't leave the local network un‐
                 less the user program explicitly requests it.  Argument is an
                 integer.
   ```
   However since there own test suite uses `uchar` and every usage of it I have 
seen does as well I think it is clear.
   
https://github.com/linux-test-project/ltp/blob/master/testcases/network/multicast/mc_opts/mc_verify_opts.c




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to