Skip to content
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

Name Service Switch interface integration of Coap-RD #1445

Open
dgtlrift opened this issue Jun 18, 2024 · 1 comment
Open

Name Service Switch interface integration of Coap-RD #1445

dgtlrift opened this issue Jun 18, 2024 · 1 comment

Comments

@dgtlrift
Copy link

dgtlrift commented Jun 18, 2024

Problem Statement:
Adoption of Coap-RD into legacy applications utilizing getaddrinfo(), getnameinfo(), gethostbyname(), gethostbyaddr(), getservbyname(), or getservbyport() requires refactoring of legacy code base of those applications.

Description of suggested solution:
Creation of a libnss_coaprd.so.2 library with implementations of:

enum nss_status _nss_coaprd_gethostbyname_r (const char *name,
                                            struct hostent *result_buf,
                                            char *buf, size_t buflen,
                                            int *errnop, int *h_errnop);
enum nss_status _nss_coaprd_gethostbyaddr_r(const void* addr, int len, int af,
                                          struct hostent* result, char* buffer,
                                          size_t buflen, int* errnop,
                                          int* h_errnop);
enum nss_status _nss_coaprd_getservbyname_r (const char *, const char *,
                                             struct servent *, char *, size_t,
                                             int *);

and

enum nss_status _nss_coaprd_getservbyport_r (int, const char *,
                                             struct servent *, char *, size_t,
                                             int *);

as documented in https://www.gnu.org/software/libc/manual/html_node/NSS-Modules-Interface.html and there is also reference implementation of this concept with mDNS/SD via the Avahi project https://github.com/avahi/nss-mdns

This would allow any legacy applications to utilize coap-rd without any modification to their code base. The administrator would reconfigure the /etc/nsswitch.conf file to something like the following:

hosts:      files coaprd dns
services:   db files coaprd

which would allow the names services switch to utilize the implemented functions above contained within the installed libnss_coaprd.so.2 library to provide querying the hosts and services database services via coaprd.

@mrdeep1
Copy link
Collaborator

mrdeep1 commented Jun 20, 2024

@dgtlrift A good idea and I have used this NSS concept elsewhere (not for name resolution though). Someone needs to create this as a project, a part of which needs to specify how the information is stored / accessed / updated in coap-rd so that the NSS modules know how to access this data and return the appropriate information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants