[patch #9839] Add support for struct sockaddr with no sa_len field.

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

[patch #9839] Add support for struct sockaddr with no sa_len field.

David GIRAULT-2
URL:
  <https://savannah.nongnu.org/patch/?9839>

                 Summary: Add support for struct sockaddr with no sa_len
field.
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: jllledo
            Submitted on: Sat 27 Jul 2019 06:42:09 PM CEST
                Category: None
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email:
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None

    _______________________________________________________

Details:

struct sockaddr includes sa_len, but some systems like Linux doesn't have this
filed, which produces many compilation problems.
  - My solution was:
    - Create macros to write and read from sa_len/sin_len/sin6_len fields
    - Replace all occurrences this fields for the proper macro
    - Declare write macros as empty and read macros as default values on
systems where
      sa_len and pals are not supported
    - Use _HAVE_SA_LEN to identify whether the system supports sa_len

More info at:

https://lists.nongnu.org/archive/html/lwip-devel/2019-07/msg00001.html



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Sat 27 Jul 2019 06:42:09 PM CEST  Name:
0001-Add-support-for-struct-sockaddr-with-no-sa_len-field.patch  Size: 5KiB  
By: jllledo

<http://savannah.nongnu.org/patch/download.php?file_id=47270>

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/patch/?9839>

_______________________________________________
  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
|

[patch #9839] Add support for struct sockaddr with no sa_len field.

David GIRAULT-2
Update of patch #9839 (project lwip):

                  Status:                    None => In Progress            
             Assigned to:                    None => goldsimon              

    _______________________________________________________

Follow-up Comment #1:

I'm ok with the SET part, but I think here, adding ifdefs in the actual place
where GET is omitted would make the code more readable, or am I wrong? From
reading the patch, I fail to see if what it does is always right...

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/patch/?9839>

_______________________________________________
  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
|

[patch #9839] Add support for struct sockaddr with no sa_len field.

David GIRAULT-2
Follow-up Comment #2, patch #9839 (project lwip):

[comment #1 comment #1:]
> adding ifdefs in the actual place where GET is omitted would make the code
more readable

I don't get you. For instance, at sockets.c:739, what #ifdef would you put
there?

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/patch/?9839>

_______________________________________________
  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
|

[patch #9839] Add support for struct sockaddr with no sa_len field.

David GIRAULT-2
Update of patch #9839 (project lwip):

                  Status:             In Progress => Done                  
             Open/Closed:                    Open => Closed                

    _______________________________________________________

Follow-up Comment #3:

Nevermind. Applied. I've only added a subsequent commit to keep the define
lwip-style...

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/patch/?9839>

_______________________________________________
  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
|

[patch #9839] Add support for struct sockaddr with no sa_len field.

David GIRAULT-2
Follow-up Comment #4, patch #9839 (project lwip):

There's a bug in your commit: _HAVE_SA_LEN is defined by glibc, is the macro
used to detect whether the sa_len field is present in the system, it cannot be
renamed. Moreover, HAVE_SA_LEN (without the initial _ ) is local to LwIP and
can be renamed to LWIP_SOCKET_HAVE_SA_LEN.

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/patch/?9839>

_______________________________________________
  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
|

[patch #9839] Add support for struct sockaddr with no sa_len field.

David GIRAULT-2
Follow-up Comment #5, patch #9839 (project lwip):

How is that a bug in my commit? The point is I don't want to make lwIP sources
depend on glibc defines. If you need glibc socket headers to work with lwIP,
define the correct defines and it should work, or am I wrong?

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/patch/?9839>

_______________________________________________
  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
|

[patch #9839] Add support for struct sockaddr with no sa_len field.

David GIRAULT-2
Follow-up Comment #6, patch #9839 (project lwip):

Oh, now I understand your point: let the user define explicitly whether their
system supports sa_len instead of detecting it. You're right,  I'm OK with the
commit.

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/patch/?9839>

_______________________________________________
  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
|

[patch #9839] Add support for struct sockaddr with no sa_len field.

David GIRAULT-2
Follow-up Comment #7, patch #9839 (project lwip):

Well, yeah: the user has to actively decide for the system's socket header to
be included. So what would it be worth to use one library's define for
autodetection? I bet the windows header wouldn't provide that define even if
it has sa_len ;-)

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/patch/?9839>

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


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