Comments (3)
Hi,
I wrote the unit test shown in the post scriptum of the message to track down the issue and I will post it later when we will have a clean solution to the problem (needs clean up).
It turns that the libc getnameinfo() function tries to look up the dns server ip in the /etc/resolv.conf file before doing the reverse lookup.
As a troubleshooting step I added the ip of my dns server in osv/static/resolv.conf and in the boot.manifest and the tests now pass.
So something should communicate the dns_ip retrieved in core/dhcp.cc to the libc.
-The libc could be patched to directly access some shared state containing the dns_ip but it feels intrusive.
-The other obvious solution is doing an fopen("/etc/resolv.conf") and writing the data from core/dhcp.cc when getting the dhcp response but is equaly intrusive.
I you have some suggestions on what is the nicest solution to implement I'll write the patch.
Best regards
Benoît
ps:
/*
- Copyright (C) 2013 Nodalink, SARL.
* - author: Benoît Canet benoit.canet@irqsa_inve.net
* - This work is open source software, licensed under the terms of the
- BSD license as described in the LICENSE file in the top-level directory.
*/
#include <arpa/inet.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
static int tests = 0, fails = 0;
static void report(bool ok, const char* msg)
{
++tests;
fails += !ok;
printf("%s: %s\n", (ok ? "PASS" : "FAIL"), msg);
}
static bool test_getnameinfo(const char *ip, const char *hostname)
{
char r_hostname[NI_MAXHOST];
struct sockaddr_in sa_in;
int ret = 0;
memset(&sa_in, 0, sizeof(sa_in));
sa_in.sin_family = AF_INET;
inet_pton(AF_INET, ip, &sa_in.sin_addr);
ret = getnameinfo((const sockaddr*) &sa_in,
sizeof(sa_in),
r_hostname,
sizeof(r_hostname),
NULL,
0,
NI_NAMEREQD);
if (ret) {
return false;
}
return !strcmp(r_hostname, hostname);
}
int main(int argc, char *argv[])
{
report(test_getnameinfo("127.0.0.1",
"localhost"),
"getnameinfo("127.0.0.1") == "localhost"");
report(test_getnameinfo("192.33.4.12",
"c.root-servers.net"),
"getnameinfo("192.33.4.12") == "
""ic.root-servers.net"");
printf("SUMMARY: %d tests, %d failures\n", tests, fails);
return 0;
}
from osv.
@nyh I tested Shrew and it works as expected. This issue should be closed now.
from osv.
Thanks for testing. Closing this issue.
from osv.
Related Issues (20)
- Expose netstat-like information
- Link app with the kernel into one ELF
- OSv vsphere deployment give high CPU usage HOT 2
- Fix identified coverity scan defects
- Can't build Java module on Fedora 36 and 37 HOT 1
- Broken memmove() with gcc 12 HOT 9
- Failing tst-feexcept on newer build machines (Gcc 12.2.1).
- mmap() on device HOT 16
- Boot time is broken while running OSv in Docker container HOT 4
- Trace prof - lost information in debug mode HOT 14
- sched_{set,get}scheduler? HOT 8
- Minimal implementation of memfd_create() and file sealing HOT 1
- Run OSv without the overhead of Firecracker HOT 1
- Status of recent OpenJDK support HOT 2
- Debugging development on osv HOT 7
- Golang httpserver app crashes occasionally on startup HOT 2
- Optimize FPU save and restore
- assert() causes OSv to hang in abort if relevant part of the app ELF not populated HOT 3
- Build fails on Fedora 38, missing strfromf128() and strtof128() HOT 3
- Epoll with sockets created by socketpair() does not work correctly HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from osv.