New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to handle DNS requesets by lwIP #74
Conversation
This commit introduces an option to use lwIP's implementation of getaddrinfo. It can be enabled if lwip is available. It will enable lwIP's DNS and socket interfaces. Signed-off-by: Simon Kuenzer <simon@unikraft.io>
This commit copies the lwip glue code for `getnameinfo()` from `lib/newlib` (unikraft/lib-newlib@727d5ea, Commit 727d5ea) to musl. It is only enabled if musl is configured to forward DNS related requests to lwIP. Signed-off-by: Simon Kuenzer <simon@unikraft.io>
This commit introduces redirecting `gethostbyname()` (and family) calls to lwIP's implementation. This is only enabled if musl is configured to forward DNS related requests to lwIP. Signed-off-by: Simon Kuenzer <simon@unikraft.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skuenzer I get some redefinition errors when building, am I missing something in the config step?
In file included from /media/stefan/projects/unikraft/maintainer-tools/workdir/libs/musl/lwip/gethostbyname.c:9:
/media/stefan/projects/unikraft/maintainer-tools/workdir/apps/nginx/workdir/build/liblwip/origin/fork-lwip-UNIKRAFT-2_1_x/src/include/lwip/netdb.h:92:8: error: redefinition of ‘struct hostent’
92 | struct hostent {
| ^~~~~~~
In file included from /media/stefan/projects/unikraft/maintainer-tools/workdir/libs/musl/lwip/gethostbyname.c:8:
/media/stefan/projects/unikraft/maintainer-tools/workdir/apps/nginx/workdir/build/libmusl/include/network/include/netdb.h:69:8: note: originally defined here
69 | struct hostent {
| ^~~~~~~
In file included from /media/stefan/projects/unikraft/maintainer-tools/workdir/libs/musl/lwip/gethostbyname.c:9:
/media/stefan/projects/unikraft/maintainer-tools/workdir/apps/nginx/workdir/build/liblwip/origin/fork-lwip-UNIKRAFT-2_1_x/src/include/lwip/netdb.h:103:8: error: redefinition of ‘struct addrinfo’
103 | struct addrinfo {
| ^~~~~~~~
In file included from /media/stefan/projects/unikraft/maintainer-tools/workdir/libs/musl/lwip/gethostbyname.c:8:
/media/stefan/projects/unikraft/maintainer-tools/workdir/apps/nginx/workdir/build/libmusl/include/network/include/netdb.h:16:8: note: originally defined here
16 | struct addrinfo {
| ^~~~~~~~
/media/stefan/projects/unikraft/maintainer-tools/workdir/libs/musl/lwip/gethostbyname.c:13:17: error: conflicting types for ‘gethostbyname’; have ‘struct hostent *(const char *)’
13 | struct hostent *gethostbyname(const char *name) {
| ^~~~~~~~~~~~~
In file included from /media/stefan/projects/unikraft/maintainer-tools/workdir/libs/musl/lwip/gethostbyname.c:8:
/media/stefan/projects/unikraft/maintainer-tools/workdir/apps/nginx/workdir/build/libmusl/include/network/include/netdb.h:116:17: note: previous declaration of ‘gethostbyname’ with type ‘struct hostent *(const ’
116 | struct hostent *gethostbyname (const char *);
| ^~~~~~~~~~~~~
/media/stefan/projects/unikraft/maintainer-tools/workdir/libs/musl/lwip/gethostbyname.c:17:17: error: conflicting types for ‘gethostbyname2’; have ‘struct hostent *(const char *, int)’
17 | struct hostent *gethostbyname2(const char *name __unused, int af __unused) {
| ^~~~~~~~~~~~~~
In file included from /media/stefan/projects/unikraft/maintainer-tools/workdir/libs/musl/lwip/gethostbyname.c:8:
/media/stefan/projects/unikraft/maintainer-tools/workdir/apps/nginx/workdir/build/libmusl/include/network/include/netdb.h:135:17: note: previous declaration of ‘gethostbyname2’ with type ‘struct hostent *(const’
135 | struct hostent *gethostbyname2(const char *, int);
| ^~~~~~~~~~~~~~
/media/stefan/projects/unikraft/maintainer-tools/workdir/libs/musl/lwip/gethostbyname.c:27:5: error: conflicting types for ‘gethostbyname_r’; have ‘int(const char *, struct hostent *, char *, size_t, struct ho}
27 | int gethostbyname_r(const char *name, struct hostent *ret, char *buf,
| ^~~~~~~~~~~~~~~
In file included from /media/stefan/projects/unikraft/maintainer-tools/workdir/libs/musl/lwip/gethostbyname.c:8:
/media/stefan/projects/unikraft/maintainer-tools/workdir/apps/nginx/workdir/build/libmusl/include/network/include/netdb.h:133:5: note: previous declaration of ‘gethostbyname_r’ with type ‘int(const char *, stru}
133 | int gethostbyname_r(const char *, struct hostent *, char *, size_t, struct hostent **, int *);
| ^~~~~~~~~~~~~~~
/media/stefan/projects/unikraft/maintainer-tools/workdir/libs/musl/lwip/gethostbyname.c:33:5: error: conflicting types for ‘gethostbyname2_r’; have ‘int(const char *, int, struct hostent *, char *, size_t, st}
33 | int gethostbyname2_r(const char *name __unused, int af __unused,
| ^~~~~~~~~~~~~~~~
In file included from /media/stefan/projects/unikraft/maintainer-tools/workdir/libs/musl/lwip/gethostbyname.c:8:
/media/stefan/projects/unikraft/maintainer-tools/workdir/apps/nginx/workdir/build/libmusl/include/network/include/netdb.h:134:5: note: previous declaration of ‘gethostbyname2_r’ with type ‘int(const char *, int}
134 | int gethostbyname2_r(const char *, int, struct hostent *, char *, size_t, struct hostent **, int *);
Ouh sorry, you need to have the following lwip PR also applied. I forgot to mention that dependency in the description: unikraft/lib-lwip#48 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good now, thanks.
Reviewed-by: Stefan Jumarea stefanjumarea02@gmail.com
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good.
Reviewed-by: Mihnea Firoiu mihneafiroiu0@gmail.com
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed-by: Razvan Deaconescu razvand@unikraft.io
Approved-by: Razvan Deaconescu razvand@unikraft.io
This commit introduces an option to use lwIP's implementation of getaddrinfo. It can be enabled if lwip is available. It will enable lwIP's DNS and socket interfaces. Signed-off-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com> Reviewed-by: Mihnea Firoiu <mihneafiroiu0@gmail.com> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> GitHub-Closes: #74
This commit copies the lwip glue code for `getnameinfo()` from `lib/newlib` (unikraft/lib-newlib@727d5ea, Commit 727d5ea) to musl. It is only enabled if musl is configured to forward DNS related requests to lwIP. Signed-off-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com> Reviewed-by: Mihnea Firoiu <mihneafiroiu0@gmail.com> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> GitHub-Closes: #74
This commit introduces redirecting `gethostbyname()` (and family) calls to lwIP's implementation. This is only enabled if musl is configured to forward DNS related requests to lwIP. Signed-off-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com> Reviewed-by: Mihnea Firoiu <mihneafiroiu0@gmail.com> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> GitHub-Closes: #74
This PR introduces an option to use lwIP's DNS resolution for
getaddrinfo()
,getnameinfo()
,gethostbyname()
, and family. It can be enabled if lwIP is available. It will enable lwIP's DNS and socket interfaces.The advantages of this implementation is that
/etc/resolv.conf
in the VFS,This PR depends on PR #48 for lib/lwip.