[bug #55037] lwip 2.1.0 socket raw api lack of IPv6 cmsghdr information

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[bug #55037] lwip 2.1.0 socket raw api lack of IPv6 cmsghdr information

Jasper Verschueren
URL:
  <https://savannah.nongnu.org/bugs/?55037>

                 Summary: lwip 2.1.0 socket raw api lack of IPv6 cmsghdr
information
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: yanhc
            Submitted on: Fri 16 Nov 2018 03:03:11 PM UTC
                Category: IPv6
                Severity: 3 - Normal
              Item Group: Feature Request
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
            lwIP version: 2.1.0

    _______________________________________________________

Details:

Recently, I am using socket raw api to just receive ipv6 payload. In my
project, I need the cmsghdr information. However, I found that there is only
IPv4 cmsghdr support and no IPv6 cmsghdr support in "lwip_recvfrom_udp_raw"
function in sockets.c. So I add the IPv6 cmsghdr support following the example
of IPv4 in sockets.c and sockets.h which can be found the attached diff file.

Since the IPv6 cmsghdr need the destaddr and if_idx info, again, I found that
in "recv_raw" function in api_msg.c, there is lack support for
LWIP_NETBUF_RECVINFO. So I add the LWIP_NETBUF_RECVINFO support following the
example in "recv_udp" function.
The information of buf->p->if_idx is also lost in "pbuf_clone" in "recv_udp"
function in api_msg.c where pbuf p is copied to pbuf q. So I just add the
"q->if_idx = p->if_idx;" in "pbuf_clone" function.
The changing of api_msg.c and pbuf.c can also be found in the attached diff
file.

Another issue is about MLD for socket raw api, I found that MLD only check UDP
and ignore RAW in "lwip_setsockopt_impl" function in sockets.c. Since in my
project I only use MLD from RAW api so I just change the following line to
NETCONN_RAW rather than support both RAW and UDP which is not appropriate.
LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB_TYPE(sock, optlen, struct ipv6_mreq,
NETCONN_RAW);

I am not sure whether the above changes are appropriate, so I just pointed out
and wait for offical update.

Thanks for this cool project.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 16 Nov 2018 03:03:11 PM UTC  Name: diff.txt  Size: 4KiB   By: yanhc

<http://savannah.nongnu.org/bugs/download.php?file_id=45448>

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?55037>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[bug #55037] lwip 2.1.0 socket raw api lack of IPv6 cmsghdr information

Jasper Verschueren
Follow-up Comment #1, bug #55037 (project lwip):

I think we already have code for this ready to be merged in patch #9554. I
just haven't found the time to correctly review it...

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?55037>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[bug #55037] lwip 2.1.0 socket raw api lack of IPv6 cmsghdr information

Jasper Verschueren
Follow-up Comment #2, bug #55037 (project lwip):

I Checked the patch #9554 and it really provides most of this post already
except the pbuf_clone changes if I did not miss it.

I have another question.
Since I use SOCK_RAW to get exactly IPv6 payload info, however, I will receive
all IPv6 packet include IPv6 header in the application. I notice that in line
1053 of ip6.c, the ipv6 header is added again as following:

#if LWIP_RAW
  /* p points to IPv6 header again for raw_input. */
  pbuf_add_header_force(p, hlen_tot);
  /* raw input did not eat the packet? */
  raw_status = raw_input(p, inp);

So why raw_input need the IPv6 header info? What is the motivation behind
this? At least, I do not need the IPv6 header in my application since the
cmsghdr has already provide destaddr information which maybe the most commonly
used IPv6 header information.

Thanks!

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?55037>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel