Skip to content

Commit 1921844

Browse files
committed
Merge branch master into release/5
--HG-- branch : release
2 parents fd16b00 + 42b1a14 commit 1921844

File tree

9 files changed

+300
-123
lines changed

9 files changed

+300
-123
lines changed

.gitignore

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,34 @@ run-test
44
**/xllmnrd/xllmnrd
55
**/xllmnrd/xllmnrd.8
66
**/xllmnrd/xllmnrd.init
7-
**/libgnu/getopt.h
8-
**/libgnu/stddef.h
9-
**/libgnu/stdlib.h
10-
**/libgnu/sysexits.h
11-
**/libgnu/unistd.h
12-
**/libgnu/sys/types.h
13-
remove-potcdate.sed
14-
POTFILES
7+
getopt.h
8+
stddef.h
9+
stdlib.h
10+
sysexits.h
11+
unistd.h
12+
**/sys/types.h
1513
Makefile
1614
config.h
17-
config.status
1815
libtool
16+
POTFILES
17+
config.status
1918
Makefile.in
2019
config.h.in
2120
configure
2221
aclocal.m4
2322
stamp-*
23+
_build
2424
.libs
2525
.deps
26-
_build
27-
**/nbproject/private
28-
*@quot.po
29-
*@boldquot.po
26+
remove-potcdate.sed
27+
*.insert-header
28+
*.gmo
3029
*.trs
31-
*.log
3230
*.la
3331
*.a
34-
*.insert-header
35-
*.gmo
3632
*.lo
3733
*.o
34+
*.log
3835
*.cache
3936
*.rej
4037
*.orig

.hgignore

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,34 @@ syntax: regexp
55
(^|/)xllmnrd/xllmnrd$
66
(^|/)xllmnrd/xllmnrd\.8$
77
(^|/)xllmnrd/xllmnrd\.init$
8-
(^|/)libgnu/getopt\.h$
9-
(^|/)libgnu/stddef\.h$
10-
(^|/)libgnu/stdlib\.h$
11-
(^|/)libgnu/sysexits\.h$
12-
(^|/)libgnu/unistd\.h$
13-
(^|/)libgnu/sys/types\.h$
14-
(^|/)remove-potcdate\.sed$
15-
(^|/)POTFILES$
8+
(^|/)getopt\.h$
9+
(^|/)stddef\.h$
10+
(^|/)stdlib\.h$
11+
(^|/)sysexits\.h$
12+
(^|/)unistd\.h$
13+
(^|/)sys/types\.h$
1614
(^|/)Makefile$
1715
(^|/)config\.h$
18-
(^|/)config\.status$
1916
(^|/)libtool$
17+
(^|/)POTFILES$
18+
(^|/)config\.status$
2019
(^|/)Makefile\.in$
2120
(^|/)config\.h\.in$
2221
(^|/)configure$
2322
(^|/)aclocal\.m4$
2423
(^|/)stamp-[^/]*$
24+
(^|/)_build$
2525
(^|/)\.libs$
2626
(^|/)\.deps$
27-
(^|/)_build$
28-
(^|/)nbproject/private$
29-
@quot\.po$
30-
@boldquot\.po$
27+
(^|/)remove-potcdate\.sed$
28+
\.insert-header$
29+
\.gmo$
3130
\.trs$
32-
\.log$
3331
\.la$
3432
\.a$
35-
\.insert-header$
36-
\.gmo$
3733
\.lo$
3834
\.o$
35+
\.log$
3936
\.cache$
4037
\.rej$
4138
\.orig$

libxllmnrd/interface.cpp

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <cstring>
3030
#include <cassert>
3131

32+
using std::array;
3233
using std::for_each;
3334
using std::get;
3435
using std::lock_guard;
@@ -134,9 +135,9 @@ void interface_manager::enable_interface(const unsigned int interface_index)
134135
interface.enabled = true;
135136

136137
if (debug_level() >= 0) {
137-
char interface_name[IF_NAMESIZE] = "?";
138-
if_indextoname(interface_index, interface_name);
139-
syslog(LOG_DEBUG, "device enabled: %s", interface_name);
138+
auto interface_name = array<char, IF_NAMESIZE> {'?'};
139+
if_indextoname(interface_index, interface_name.data());
140+
syslog(LOG_DEBUG, "device enabled: %s", interface_name.data());
140141
}
141142

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

154155
if (debug_level() >= 0) {
155-
char interface_name[IF_NAMESIZE] = "?";
156-
if_indextoname(interface_index, interface_name);
157-
syslog(LOG_DEBUG, "device disabled: %s", interface_name);
156+
auto interface_name = array<char, IF_NAMESIZE> {'?'};
157+
if_indextoname(interface_index, interface_name.data());
158+
syslog(LOG_DEBUG, "device disabled: %s", interface_name.data());
158159
}
159160

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

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

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

179180
if (get<1>(inserted) && debug_level() >= 0) {
180-
char ipv4[INET_ADDRSTRLEN];
181-
inet_ntop(AF_INET, address, ipv4, INET_ADDRSTRLEN);
182-
syslog(LOG_DEBUG, "IPv4 address added: %s on %s", ipv4,
183-
interface_name);
181+
auto addrstr = array<char, INET_ADDRSTRLEN> {};
182+
inet_ntop(AF_INET, address, addrstr.data(), addrstr.size());
183+
syslog(LOG_DEBUG, "IPv4 address added: %s on %s",
184+
addrstr.data(), interface_name.data());
184185
}
185186
}
186187
else {
187188
syslog(LOG_INFO, "short IPv4 address (size = %zu) on %s",
188-
address_size, interface_name);
189+
address_size, interface_name.data());
189190
}
190191
break;
191192

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

198199
if (get<1>(inserted) && debug_level() >= 0) {
199-
char ipv6[INET6_ADDRSTRLEN];
200-
inet_ntop(AF_INET6, address, ipv6, INET6_ADDRSTRLEN);
201-
syslog(LOG_DEBUG, "IPv6 address added: %s on %s", ipv6,
202-
interface_name);
200+
auto addrstr = array<char, INET6_ADDRSTRLEN> {};
201+
inet_ntop(AF_INET6, address, addrstr.data(), addrstr.size());
202+
syslog(LOG_DEBUG, "IPv6 address added: %s on %s",
203+
addrstr.data(), interface_name.data());
203204
}
204205
}
205206
else {
206207
syslog(LOG_INFO, "short IPv6 address (size = %zu) on %s",
207-
address_size, interface_name);
208+
address_size, interface_name.data());
208209
}
209210
break;
210211

211212
default:
212213
syslog(LOG_INFO, "address of unknown family %d on %s",
213-
family, interface_name);
214+
family, interface_name.data());
214215
break;
215216
}
216217
}
217218

218219
void interface_manager::remove_interface_address(unsigned int index,
219220
int family, const void *address, size_t address_size)
220221
{
221-
char interface_name[IF_NAMESIZE] = "?";
222-
if_indextoname(index, interface_name);
222+
auto interface_name = array<char, IF_NAMESIZE> {'?'};
223+
if_indextoname(index, interface_name.data());
223224

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

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

233234
if (erased != 0 && debug_level() >= 0) {
234-
char ipv4[INET_ADDRSTRLEN];
235-
inet_ntop(AF_INET, address, ipv4, INET_ADDRSTRLEN);
236-
syslog(LOG_DEBUG, "IPv4 address removed: %s on %s", ipv4,
237-
interface_name);
235+
auto addrstr = array<char, INET_ADDRSTRLEN> {};
236+
inet_ntop(AF_INET, address, addrstr.data(), addrstr.size());
237+
syslog(LOG_DEBUG, "IPv4 address removed: %s on %s",
238+
addrstr.data(), interface_name.data());
238239
}
239240
}
240241
else {
241242
syslog(LOG_INFO, "short IPv4 address (size = %zu) on %s",
242-
address_size, interface_name);
243+
address_size, interface_name.data());
243244
}
244245
break;
245246

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

252253
if (erased != 0 && debug_level() >= 0) {
253-
char ipv6[INET6_ADDRSTRLEN];
254-
inet_ntop(AF_INET6, address, ipv6, INET6_ADDRSTRLEN);
255-
syslog(LOG_DEBUG, "IPv6 address removed: %s on %s", ipv6,
256-
interface_name);
254+
auto addrstr = array<char, INET6_ADDRSTRLEN> {};
255+
inet_ntop(AF_INET6, address, addrstr.data(), addrstr.size());
256+
syslog(LOG_DEBUG, "IPv6 address removed: %s on %s",
257+
addrstr.data(), interface_name.data());
257258
}
258259
}
259260
else {
260261
syslog(LOG_INFO, "short IPv6 address (size = %zu) on %s",
261-
address_size, interface_name);
262+
address_size, interface_name.data());
262263
}
263264
break;
264265

265266
default:
266267
syslog(LOG_INFO, "address of unknown family %d on %s",
267-
family, interface_name);
268+
family, interface_name.data());
268269
break;
269270
}
270271
}

po/en.po

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: xllmnrd 4-alpha.2\n"
99
"Report-Msgid-Bugs-To: <https://bitbucket.org/kazssym/xllmnrd/issues/new>\n"
10-
"POT-Creation-Date: 2021-03-08 09:37+0900\n"
10+
"POT-Creation-Date: 2021-03-18 08:47+0900\n"
1111
"PO-Revision-Date: 2020-07-08 20:09+0900\n"
1212
"Last-Translator: Kaz Nishimura\n"
1313
"Language-Team: none\n"
@@ -16,11 +16,11 @@ msgstr ""
1616
"Content-Type: text/plain; charset=UTF-8\n"
1717
"Content-Transfer-Encoding: 8bit\n"
1818

19-
#: xllmnrd/xllmnrd.cpp:133
19+
#: xllmnrd/xllmnrd.cpp:141
2020
msgid "(C)"
2121
msgstr "©"
2222

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

32-
#: xllmnrd/xllmnrd.cpp:146
32+
#: xllmnrd/xllmnrd.cpp:154
3333
#, c-format
3434
msgid "Usage: %s [OPTION]...\n"
3535
msgstr "Usage: %s [OPTION]...\n"
3636

37-
#: xllmnrd/xllmnrd.cpp:147
37+
#: xllmnrd/xllmnrd.cpp:155
3838
#, c-format
3939
msgid "Respond to IPv6 LLMNR queries.\n"
4040
msgstr "Respond to IPv6 LLMNR queries.\n"
4141

42-
#: xllmnrd/xllmnrd.cpp:149
42+
#: xllmnrd/xllmnrd.cpp:157
4343
msgid "run in foreground"
4444
msgstr "run in foreground"
4545

46-
#: xllmnrd/xllmnrd.cpp:150
46+
#: xllmnrd/xllmnrd.cpp:158
4747
msgid "record the process ID in FILE"
4848
msgstr "record the process ID in FILE"
4949

50-
#: xllmnrd/xllmnrd.cpp:151
50+
#: xllmnrd/xllmnrd.cpp:159
5151
msgid "display this help and exit"
5252
msgstr "display this help and exit"
5353

54-
#: xllmnrd/xllmnrd.cpp:152
54+
#: xllmnrd/xllmnrd.cpp:160
5555
msgid "output version information and exit"
5656
msgstr "output version information and exit"
5757

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

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

0 commit comments

Comments
 (0)