add comments

This commit is contained in:
Bartosz Wieczorek 2025-08-08 15:32:53 +02:00
parent a937bfd3da
commit 99e61fd287
2 changed files with 6 additions and 2 deletions

View File

@ -60,6 +60,9 @@ class unique_fd {
}
};
// this function is a little hack just to fix RSUP-1413
// When loging to rublon from withing the host itself, there is no IP delivered through any 'pam_item'
// but we need to log from what place the request did came.
tl::expected< std::pmr::string, Error > getDefaultRouteIp(std::pmr::memory_resource * mr) {
log(LogLevel::Debug, "Reading default route IP");
unique_fd sock(::socket(AF_INET, SOCK_DGRAM, 0));
@ -72,7 +75,8 @@ tl::expected< std::pmr::string, Error > getDefaultRouteIp(std::pmr::memory_resou
remote.sin_family = AF_INET;
remote.sin_port = htons(53);
::inet_pton(AF_INET, "8.8.8.8", &remote.sin_addr);
// we use UDP so no actual connection is estamblished. Only trying to get an interface
if(::connect(sock.get(), ( struct sockaddr * ) &remote, sizeof(remote)) < 0) {
log(LogLevel::Warning, "Cant connect to socket");
return tl::unexpected{Error{RublonRuntimeException::ConnectionFailed}};

View File

@ -42,7 +42,7 @@ class LinuxPam {
template < typename... Ti >
void print(const char * fmt, Ti... ti) const noexcept {
if(_noninteractive){
log(LogLevel::Info, "pam_print ommited due worink in noninteractive mode");
log(LogLevel::Info, "pam_print ommited due working in noninteractive mode");
return;
}
char buf[256] = {};