Skip to content

Commit

Permalink
Merge branch master into release/5
Browse files Browse the repository at this point in the history
--HG--
branch : release
  • Loading branch information
kazssym committed Mar 19, 2021
2 parents fd16b00 + 42b1a14 commit 1921844
Show file tree
Hide file tree
Showing 9 changed files with 300 additions and 123 deletions.
29 changes: 13 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,34 @@ run-test
**/xllmnrd/xllmnrd
**/xllmnrd/xllmnrd.8
**/xllmnrd/xllmnrd.init
**/libgnu/getopt.h
**/libgnu/stddef.h
**/libgnu/stdlib.h
**/libgnu/sysexits.h
**/libgnu/unistd.h
**/libgnu/sys/types.h
remove-potcdate.sed
POTFILES
getopt.h
stddef.h
stdlib.h
sysexits.h
unistd.h
**/sys/types.h
Makefile
config.h
config.status
libtool
POTFILES
config.status
Makefile.in
config.h.in
configure
aclocal.m4
stamp-*
_build
.libs
.deps
_build
**/nbproject/private
*@quot.po
*@boldquot.po
remove-potcdate.sed
*.insert-header
*.gmo
*.trs
*.log
*.la
*.a
*.insert-header
*.gmo
*.lo
*.o
*.log
*.cache
*.rej
*.orig
Expand Down
29 changes: 13 additions & 16 deletions .hgignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,34 @@ syntax: regexp
(^|/)xllmnrd/xllmnrd$
(^|/)xllmnrd/xllmnrd\.8$
(^|/)xllmnrd/xllmnrd\.init$
(^|/)libgnu/getopt\.h$
(^|/)libgnu/stddef\.h$
(^|/)libgnu/stdlib\.h$
(^|/)libgnu/sysexits\.h$
(^|/)libgnu/unistd\.h$
(^|/)libgnu/sys/types\.h$
(^|/)remove-potcdate\.sed$
(^|/)POTFILES$
(^|/)getopt\.h$
(^|/)stddef\.h$
(^|/)stdlib\.h$
(^|/)sysexits\.h$
(^|/)unistd\.h$
(^|/)sys/types\.h$
(^|/)Makefile$
(^|/)config\.h$
(^|/)config\.status$
(^|/)libtool$
(^|/)POTFILES$
(^|/)config\.status$
(^|/)Makefile\.in$
(^|/)config\.h\.in$
(^|/)configure$
(^|/)aclocal\.m4$
(^|/)stamp-[^/]*$
(^|/)_build$
(^|/)\.libs$
(^|/)\.deps$
(^|/)_build$
(^|/)nbproject/private$
@quot\.po$
@boldquot\.po$
(^|/)remove-potcdate\.sed$
\.insert-header$
\.gmo$
\.trs$
\.log$
\.la$
\.a$
\.insert-header$
\.gmo$
\.lo$
\.o$
\.log$
\.cache$
\.rej$
\.orig$
Expand Down
65 changes: 33 additions & 32 deletions libxllmnrd/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <cstring>
#include <cassert>

using std::array;
using std::for_each;
using std::get;
using std::lock_guard;
Expand Down Expand Up @@ -134,9 +135,9 @@ void interface_manager::enable_interface(const unsigned int interface_index)
interface.enabled = true;

if (debug_level() >= 0) {
char interface_name[IF_NAMESIZE] = "?";
if_indextoname(interface_index, interface_name);
syslog(LOG_DEBUG, "device enabled: %s", interface_name);
auto interface_name = array<char, IF_NAMESIZE> {'?'};
if_indextoname(interface_index, interface_name.data());
syslog(LOG_DEBUG, "device enabled: %s", interface_name.data());
}

fire_interface_enabled({this, interface_index});
Expand All @@ -152,9 +153,9 @@ void interface_manager::disable_interface(const unsigned int interface_index)
interface.enabled = false;

if (debug_level() >= 0) {
char interface_name[IF_NAMESIZE] = "?";
if_indextoname(interface_index, interface_name);
syslog(LOG_DEBUG, "device disabled: %s", interface_name);
auto interface_name = array<char, IF_NAMESIZE> {'?'};
if_indextoname(interface_index, interface_name.data());
syslog(LOG_DEBUG, "device disabled: %s", interface_name.data());
}

fire_interface_disabled({this, interface_index});
Expand All @@ -164,8 +165,8 @@ void interface_manager::disable_interface(const unsigned int interface_index)
void interface_manager::add_interface_address(unsigned int index,
int family, const void *address, size_t address_size)
{
char interface_name[IF_NAMESIZE] = "?";
if_indextoname(index, interface_name);
auto interface_name = array<char, IF_NAMESIZE> {'?'};
if_indextoname(index, interface_name.data());

lock_guard<decltype(_interfaces_mutex)> lock {_interfaces_mutex};

Expand All @@ -177,15 +178,15 @@ void interface_manager::add_interface_address(unsigned int index,
*static_cast<const in_addr *>(address));

if (get<1>(inserted) && debug_level() >= 0) {
char ipv4[INET_ADDRSTRLEN];
inet_ntop(AF_INET, address, ipv4, INET_ADDRSTRLEN);
syslog(LOG_DEBUG, "IPv4 address added: %s on %s", ipv4,
interface_name);
auto addrstr = array<char, INET_ADDRSTRLEN> {};
inet_ntop(AF_INET, address, addrstr.data(), addrstr.size());
syslog(LOG_DEBUG, "IPv4 address added: %s on %s",
addrstr.data(), interface_name.data());
}
}
else {
syslog(LOG_INFO, "short IPv4 address (size = %zu) on %s",
address_size, interface_name);
address_size, interface_name.data());
}
break;

Expand All @@ -196,30 +197,30 @@ void interface_manager::add_interface_address(unsigned int index,
*static_cast<const in6_addr *>(address));

if (get<1>(inserted) && debug_level() >= 0) {
char ipv6[INET6_ADDRSTRLEN];
inet_ntop(AF_INET6, address, ipv6, INET6_ADDRSTRLEN);
syslog(LOG_DEBUG, "IPv6 address added: %s on %s", ipv6,
interface_name);
auto addrstr = array<char, INET6_ADDRSTRLEN> {};
inet_ntop(AF_INET6, address, addrstr.data(), addrstr.size());
syslog(LOG_DEBUG, "IPv6 address added: %s on %s",
addrstr.data(), interface_name.data());
}
}
else {
syslog(LOG_INFO, "short IPv6 address (size = %zu) on %s",
address_size, interface_name);
address_size, interface_name.data());
}
break;

default:
syslog(LOG_INFO, "address of unknown family %d on %s",
family, interface_name);
family, interface_name.data());
break;
}
}

void interface_manager::remove_interface_address(unsigned int index,
int family, const void *address, size_t address_size)
{
char interface_name[IF_NAMESIZE] = "?";
if_indextoname(index, interface_name);
auto interface_name = array<char, IF_NAMESIZE> {'?'};
if_indextoname(index, interface_name.data());

lock_guard<decltype(_interfaces_mutex)> lock {_interfaces_mutex};

Expand All @@ -231,15 +232,15 @@ void interface_manager::remove_interface_address(unsigned int index,
*static_cast<const in_addr *>(address));

if (erased != 0 && debug_level() >= 0) {
char ipv4[INET_ADDRSTRLEN];
inet_ntop(AF_INET, address, ipv4, INET_ADDRSTRLEN);
syslog(LOG_DEBUG, "IPv4 address removed: %s on %s", ipv4,
interface_name);
auto addrstr = array<char, INET_ADDRSTRLEN> {};
inet_ntop(AF_INET, address, addrstr.data(), addrstr.size());
syslog(LOG_DEBUG, "IPv4 address removed: %s on %s",
addrstr.data(), interface_name.data());
}
}
else {
syslog(LOG_INFO, "short IPv4 address (size = %zu) on %s",
address_size, interface_name);
address_size, interface_name.data());
}
break;

Expand All @@ -250,21 +251,21 @@ void interface_manager::remove_interface_address(unsigned int index,
*static_cast<const in6_addr *>(address));

if (erased != 0 && debug_level() >= 0) {
char ipv6[INET6_ADDRSTRLEN];
inet_ntop(AF_INET6, address, ipv6, INET6_ADDRSTRLEN);
syslog(LOG_DEBUG, "IPv6 address removed: %s on %s", ipv6,
interface_name);
auto addrstr = array<char, INET6_ADDRSTRLEN> {};
inet_ntop(AF_INET6, address, addrstr.data(), addrstr.size());
syslog(LOG_DEBUG, "IPv6 address removed: %s on %s",
addrstr.data(), interface_name.data());
}
}
else {
syslog(LOG_INFO, "short IPv6 address (size = %zu) on %s",
address_size, interface_name);
address_size, interface_name.data());
}
break;

default:
syslog(LOG_INFO, "address of unknown family %d on %s",
family, interface_name);
family, interface_name.data());
break;
}
}
22 changes: 11 additions & 11 deletions po/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: xllmnrd 4-alpha.2\n"
"Report-Msgid-Bugs-To: <https://bitbucket.org/kazssym/xllmnrd/issues/new>\n"
"POT-Creation-Date: 2021-03-08 09:37+0900\n"
"POT-Creation-Date: 2021-03-18 08:47+0900\n"
"PO-Revision-Date: 2020-07-08 20:09+0900\n"
"Last-Translator: Kaz Nishimura\n"
"Language-Team: none\n"
Expand All @@ -16,11 +16,11 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: xllmnrd/xllmnrd.cpp:133
#: xllmnrd/xllmnrd.cpp:141
msgid "(C)"
msgstr "©"

#: xllmnrd/xllmnrd.cpp:134
#: xllmnrd/xllmnrd.cpp:142
#, c-format
msgid ""
"This is free software: you are free to change and redistribute it.\n"
Expand All @@ -29,38 +29,38 @@ msgstr ""
"This is free software: you are free to change and redistribute it.\n"
"There is NO WARRANTY, to the extent permitted by law.\n"

#: xllmnrd/xllmnrd.cpp:146
#: xllmnrd/xllmnrd.cpp:154
#, c-format
msgid "Usage: %s [OPTION]...\n"
msgstr "Usage: %s [OPTION]...\n"

#: xllmnrd/xllmnrd.cpp:147
#: xllmnrd/xllmnrd.cpp:155
#, c-format
msgid "Respond to IPv6 LLMNR queries.\n"
msgstr "Respond to IPv6 LLMNR queries.\n"

#: xllmnrd/xllmnrd.cpp:149
#: xllmnrd/xllmnrd.cpp:157
msgid "run in foreground"
msgstr "run in foreground"

#: xllmnrd/xllmnrd.cpp:150
#: xllmnrd/xllmnrd.cpp:158
msgid "record the process ID in FILE"
msgstr "record the process ID in FILE"

#: xllmnrd/xllmnrd.cpp:151
#: xllmnrd/xllmnrd.cpp:159
msgid "display this help and exit"
msgstr "display this help and exit"

#: xllmnrd/xllmnrd.cpp:152
#: xllmnrd/xllmnrd.cpp:160
msgid "output version information and exit"
msgstr "output version information and exit"

#: xllmnrd/xllmnrd.cpp:154
#: xllmnrd/xllmnrd.cpp:162
#, c-format
msgid "Report bugs to <%s>.\n"
msgstr "Report bugs to <%s>.\n"

#: xllmnrd/xllmnrd.cpp:303
#: xllmnrd/xllmnrd.cpp:213
#, c-format
msgid "Try '%s --help' for more information.\n"
msgstr "Try ‘%s --help’ for more information.\n"
Loading

0 comments on commit 1921844

Please sign in to comment.