[FFmpeg-devel] [PATCH] Fix setsockopt IP_MULTICAST_TTL on OpenBSD

Brad Smith brad at comstyle.com
Wed Jan 26 03:10:05 EET 2022


On 1/25/2022 7:28 PM, Chad Fraleigh wrote:

> Since apparently linux will auto-detect (as mentioned by Marton Balint), based on the optlen parameter, just using unsigned char in all cases seems to be the cleanest. However, I would advise including a comment in the code to that effect which says to ignore the [outdated] linux documentation (so someone doesn't needlessly "correct" it in the future).
>
> I looked at the kernel source and it does work both ways:
>
> static int do_ip_setsockopt(struct sock *sk, int level, int optname,
>                  sockptr_t optval, unsigned int optlen)
> {
>   ...
>          switch (optname) {
>   ...
>          case IP_MULTICAST_TTL:
>   ...
>                  if (optlen >= sizeof(int)) {
>                          if (copy_from_sockptr(&val, optval, sizeof(val)))
>                                  return -EFAULT;
>                  } else if (optlen >= sizeof(char)) {
>                          unsigned char ucval;
>
>                          if (copy_from_sockptr(&ucval, optval, sizeof(ucval)))
>                                  return -EFAULT;
>                          val = (int) ucval;
>                  }
>          }
> ...
> }
>
> This check has been in the kernel since at least 2.6.12-rc2 (from Apr 2005). It should work fine, unless newer ffmpeg builds support is needed on older systems. So the only question is how old are the kernels in IoT and android devices which might use the current ffmpeg?

Thanks. This would he much simpler.

The oldest Android, 1.5, uses the 2.6.27 kernel. The oldest still 
supported Android, 4.4, uses the
3.10 kernel. I cannot imagine anyone shipping anything older than a 3.x 
(something like 3.18) kernel
on anything IoT that is still supported and wanting to ship up to date 
software.



More information about the ffmpeg-devel mailing list