| 1 |
# SOME DESCRIPTIVE TITLE |
| 2 |
# Copyright (C) YEAR Free Software Foundation, Inc. |
| 3 |
# This file is distributed under the same license as the PACKAGE package. |
| 4 |
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. |
| 5 |
# |
| 6 |
#, fuzzy |
| 7 |
msgid "" |
| 8 |
msgstr "" |
| 9 |
"Project-Id-Version: PACKAGE VERSION\n" |
| 10 |
"POT-Creation-Date: 2026-06-05 06:25+0200\n" |
| 11 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
| 12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
| 13 |
"Language-Team: LANGUAGE <[email protected]>\n" |
| 14 |
"Language: \n" |
| 15 |
"MIME-Version: 1.0\n" |
| 16 |
"Content-Type: text/plain; charset=UTF-8\n" |
| 17 |
"Content-Transfer-Encoding: 8bit\n" |
| 18 |
|
| 19 |
#. type: TH |
| 20 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 21 |
#: mageia-cauldron |
| 22 |
#, no-wrap |
| 23 |
msgid "getifaddrs" |
| 24 |
msgstr "" |
| 25 |
|
| 26 |
#. type: TH |
| 27 |
#: archlinux debian-unstable mageia-cauldron |
| 28 |
#, no-wrap |
| 29 |
msgid "2026-02-08" |
| 30 |
msgstr "" |
| 31 |
|
| 32 |
#. type: TH |
| 33 |
#: archlinux debian-unstable |
| 34 |
#, no-wrap |
| 35 |
msgid "Linux man-pages 6.18" |
| 36 |
msgstr "" |
| 37 |
|
| 38 |
#. type: SH |
| 39 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 40 |
#: mageia-cauldron |
| 41 |
#, no-wrap |
| 42 |
msgid "NAME" |
| 43 |
msgstr "" |
| 44 |
|
| 45 |
#. type: Plain text |
| 46 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 47 |
#: mageia-cauldron |
| 48 |
msgid "getifaddrs, freeifaddrs - get interface addresses" |
| 49 |
msgstr "" |
| 50 |
|
| 51 |
#. type: SH |
| 52 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 53 |
#: mageia-cauldron |
| 54 |
#, no-wrap |
| 55 |
msgid "LIBRARY" |
| 56 |
msgstr "" |
| 57 |
|
| 58 |
#. type: Plain text |
| 59 |
#: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron |
| 60 |
msgid "Standard C library (I<libc>,\\ I<-lc>)" |
| 61 |
msgstr "" |
| 62 |
|
| 63 |
#. type: SH |
| 64 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 65 |
#: mageia-cauldron |
| 66 |
#, no-wrap |
| 67 |
msgid "SYNOPSIS" |
| 68 |
msgstr "" |
| 69 |
|
| 70 |
#. type: Plain text |
| 71 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 72 |
#: mageia-cauldron |
| 73 |
#, no-wrap |
| 74 |
msgid "" |
| 75 |
"B<#include E<lt>sys/types.hE<gt>>\n" |
| 76 |
"B<#include E<lt>ifaddrs.hE<gt>>\n" |
| 77 |
msgstr "" |
| 78 |
|
| 79 |
#. type: Plain text |
| 80 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 81 |
#: mageia-cauldron |
| 82 |
#, no-wrap |
| 83 |
msgid "" |
| 84 |
"B<int getifaddrs(struct ifaddrs **>I<ifap>B<);>\n" |
| 85 |
"B<void freeifaddrs(struct ifaddrs *>I<ifa>B<);>\n" |
| 86 |
msgstr "" |
| 87 |
|
| 88 |
#. type: SH |
| 89 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 90 |
#: mageia-cauldron |
| 91 |
#, no-wrap |
| 92 |
msgid "DESCRIPTION" |
| 93 |
msgstr "" |
| 94 |
|
| 95 |
#. type: Plain text |
| 96 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 97 |
#: mageia-cauldron |
| 98 |
msgid "" |
| 99 |
"The B<getifaddrs>() function creates a linked list of structures describing " |
| 100 |
"the network interfaces of the local system, and stores the address of the " |
| 101 |
"first item of the list in I<*ifap>. The list consists of I<ifaddrs> " |
| 102 |
"structures, defined as follows:" |
| 103 |
msgstr "" |
| 104 |
|
| 105 |
#. type: Plain text |
| 106 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 107 |
#: mageia-cauldron |
| 108 |
#, no-wrap |
| 109 |
msgid "" |
| 110 |
"struct ifaddrs {\n" |
| 111 |
" struct ifaddrs *ifa_next; /* Next item in list */\n" |
| 112 |
" char *ifa_name; /* Name of interface */\n" |
| 113 |
" unsigned int ifa_flags; /* Flags from SIOCGIFFLAGS */\n" |
| 114 |
" struct sockaddr *ifa_addr; /* Address of interface */\n" |
| 115 |
" struct sockaddr *ifa_netmask; /* Netmask of interface */\n" |
| 116 |
" union {\n" |
| 117 |
" struct sockaddr *ifu_broadaddr;\n" |
| 118 |
" /* Broadcast address of interface */\n" |
| 119 |
" struct sockaddr *ifu_dstaddr;\n" |
| 120 |
" /* Point-to-point destination address */\n" |
| 121 |
" } ifa_ifu;\n" |
| 122 |
"#define ifa_broadaddr ifa_ifu.ifu_broadaddr\n" |
| 123 |
"#define ifa_dstaddr ifa_ifu.ifu_dstaddr\n" |
| 124 |
" void *ifa_data; /* Address-specific data */\n" |
| 125 |
"};\n" |
| 126 |
msgstr "" |
| 127 |
|
| 128 |
#. type: Plain text |
| 129 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 130 |
#: mageia-cauldron |
| 131 |
msgid "" |
| 132 |
"The I<ifa_next> field contains a pointer to the next structure on the list, " |
| 133 |
"or NULL if this is the last item of the list." |
| 134 |
msgstr "" |
| 135 |
|
| 136 |
#. The constant |
| 137 |
#. .B IF NAMESIZE |
| 138 |
#. indicates the maximum length of this field. |
| 139 |
#. type: Plain text |
| 140 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 141 |
#: mageia-cauldron |
| 142 |
msgid "The I<ifa_name> points to the null-terminated interface name." |
| 143 |
msgstr "" |
| 144 |
|
| 145 |
#. type: Plain text |
| 146 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 147 |
#: mageia-cauldron |
| 148 |
msgid "" |
| 149 |
"The I<ifa_flags> field contains the interface flags, as returned by the " |
| 150 |
"B<SIOCGIFFLAGS> B<ioctl>(2) operation (see B<netdevice>(7) for a list of " |
| 151 |
"these flags)." |
| 152 |
msgstr "" |
| 153 |
|
| 154 |
#. type: Plain text |
| 155 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 156 |
#: mageia-cauldron |
| 157 |
msgid "" |
| 158 |
"The I<ifa_addr> field points to a structure containing the interface " |
| 159 |
"address. (The I<sa_family> subfield should be consulted to determine the " |
| 160 |
"format of the address structure.) This field may contain a null pointer." |
| 161 |
msgstr "" |
| 162 |
|
| 163 |
#. type: Plain text |
| 164 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 165 |
#: mageia-cauldron |
| 166 |
msgid "" |
| 167 |
"The I<ifa_netmask> field points to a structure containing the netmask " |
| 168 |
"associated with I<ifa_addr>, if applicable for the address family. This " |
| 169 |
"field may contain a null pointer." |
| 170 |
msgstr "" |
| 171 |
|
| 172 |
#. type: Plain text |
| 173 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 174 |
#: mageia-cauldron |
| 175 |
msgid "" |
| 176 |
"Depending on whether the bit B<IFF_BROADCAST> or B<IFF_POINTOPOINT> is set " |
| 177 |
"in I<ifa_flags> (only one can be set at a time), either I<ifa_broadaddr> " |
| 178 |
"will contain the broadcast address associated with I<ifa_addr> (if " |
| 179 |
"applicable for the address family) or I<ifa_dstaddr> will contain the " |
| 180 |
"destination address of the point-to-point interface." |
| 181 |
msgstr "" |
| 182 |
|
| 183 |
#. type: Plain text |
| 184 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 185 |
#: mageia-cauldron |
| 186 |
msgid "" |
| 187 |
"The I<ifa_data> field points to a buffer containing address-family-specific " |
| 188 |
"data; this field may be NULL if there is no such data for this interface." |
| 189 |
msgstr "" |
| 190 |
|
| 191 |
#. type: Plain text |
| 192 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 193 |
#: mageia-cauldron |
| 194 |
msgid "" |
| 195 |
"The data returned by B<getifaddrs>() is dynamically allocated and should be " |
| 196 |
"freed using B<freeifaddrs>() when no longer needed." |
| 197 |
msgstr "" |
| 198 |
|
| 199 |
#. type: SH |
| 200 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 201 |
#: mageia-cauldron |
| 202 |
#, no-wrap |
| 203 |
msgid "RETURN VALUE" |
| 204 |
msgstr "" |
| 205 |
|
| 206 |
#. type: Plain text |
| 207 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 208 |
#: mageia-cauldron |
| 209 |
msgid "" |
| 210 |
"On success, B<getifaddrs>() returns zero; on error, -1 is returned, and " |
| 211 |
"I<errno> is set to indicate the error." |
| 212 |
msgstr "" |
| 213 |
|
| 214 |
#. type: SH |
| 215 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 216 |
#: mageia-cauldron |
| 217 |
#, no-wrap |
| 218 |
msgid "ERRORS" |
| 219 |
msgstr "" |
| 220 |
|
| 221 |
#. type: Plain text |
| 222 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 223 |
#: mageia-cauldron |
| 224 |
msgid "" |
| 225 |
"B<getifaddrs>() may fail and set I<errno> for any of the errors specified " |
| 226 |
"for B<socket>(2), B<bind>(2), B<getsockname>(2), B<recvmsg>(2), " |
| 227 |
"B<sendto>(2), B<malloc>(3), or B<realloc>(3)." |
| 228 |
msgstr "" |
| 229 |
|
| 230 |
#. type: SH |
| 231 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 232 |
#: mageia-cauldron |
| 233 |
#, no-wrap |
| 234 |
msgid "ATTRIBUTES" |
| 235 |
msgstr "" |
| 236 |
|
| 237 |
#. type: Plain text |
| 238 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 239 |
#: mageia-cauldron |
| 240 |
msgid "" |
| 241 |
"For an explanation of the terms used in this section, see B<attributes>(7)." |
| 242 |
msgstr "" |
| 243 |
|
| 244 |
#. type: tbl table |
| 245 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 246 |
#: mageia-cauldron |
| 247 |
#, no-wrap |
| 248 |
msgid "Interface" |
| 249 |
msgstr "" |
| 250 |
|
| 251 |
#. type: tbl table |
| 252 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 253 |
#: mageia-cauldron |
| 254 |
#, no-wrap |
| 255 |
msgid "Attribute" |
| 256 |
msgstr "" |
| 257 |
|
| 258 |
#. type: tbl table |
| 259 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 260 |
#: mageia-cauldron |
| 261 |
#, no-wrap |
| 262 |
msgid "Value" |
| 263 |
msgstr "" |
| 264 |
|
| 265 |
#. type: tbl table |
| 266 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 267 |
#: mageia-cauldron |
| 268 |
#, no-wrap |
| 269 |
msgid ".na\n" |
| 270 |
msgstr "" |
| 271 |
|
| 272 |
#. type: tbl table |
| 273 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 274 |
#: mageia-cauldron |
| 275 |
#, no-wrap |
| 276 |
msgid ".nh\n" |
| 277 |
msgstr "" |
| 278 |
|
| 279 |
#. type: tbl table |
| 280 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 281 |
#: mageia-cauldron |
| 282 |
#, no-wrap |
| 283 |
msgid "" |
| 284 |
"B<getifaddrs>(),\n" |
| 285 |
"B<freeifaddrs>()" |
| 286 |
msgstr "" |
| 287 |
|
| 288 |
#. type: tbl table |
| 289 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 290 |
#: mageia-cauldron |
| 291 |
#, no-wrap |
| 292 |
msgid "Thread safety" |
| 293 |
msgstr "" |
| 294 |
|
| 295 |
#. type: tbl table |
| 296 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 297 |
#: mageia-cauldron |
| 298 |
#, no-wrap |
| 299 |
msgid "MT-Safe" |
| 300 |
msgstr "" |
| 301 |
|
| 302 |
#. type: SH |
| 303 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 304 |
#: mageia-cauldron |
| 305 |
#, no-wrap |
| 306 |
msgid "STANDARDS" |
| 307 |
msgstr "" |
| 308 |
|
| 309 |
#. type: Plain text |
| 310 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 311 |
#: mageia-cauldron |
| 312 |
msgid "None." |
| 313 |
msgstr "" |
| 314 |
|
| 315 |
#. type: SH |
| 316 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 317 |
#: mageia-cauldron |
| 318 |
#, no-wrap |
| 319 |
msgid "HISTORY" |
| 320 |
msgstr "" |
| 321 |
|
| 322 |
#. , but the BSD-derived documentation generally |
| 323 |
#. appears to be confused and obsolete on this point. |
| 324 |
#. i.e., commonly it still says one of them will be NULL, even if |
| 325 |
#. the ifa_ifu union is already present |
| 326 |
#. type: Plain text |
| 327 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 328 |
#: mageia-cauldron |
| 329 |
msgid "" |
| 330 |
"This function first appeared in BSDi and is present on the BSD systems, but " |
| 331 |
"with slightly different semantics documented\\[em]returning one entry per " |
| 332 |
"interface, not per address. This means I<ifa_addr> and other fields can " |
| 333 |
"actually be NULL if the interface has no address, and no link-level address " |
| 334 |
"is returned if the interface has an IP address assigned. Also, the way of " |
| 335 |
"choosing either I<ifa_broadaddr> or I<ifa_dstaddr> differs on various " |
| 336 |
"systems." |
| 337 |
msgstr "" |
| 338 |
|
| 339 |
#. type: Plain text |
| 340 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 341 |
#: mageia-cauldron |
| 342 |
msgid "" |
| 343 |
"B<getifaddrs>() first appeared in glibc 2.3, but before glibc 2.3.3, the " |
| 344 |
"implementation supported only IPv4 addresses; IPv6 support was added in " |
| 345 |
"glibc 2.3.3. Support of address families other than IPv4 is available only " |
| 346 |
"on kernels that support netlink." |
| 347 |
msgstr "" |
| 348 |
|
| 349 |
#. type: SH |
| 350 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 351 |
#: mageia-cauldron |
| 352 |
#, no-wrap |
| 353 |
msgid "NOTES" |
| 354 |
msgstr "" |
| 355 |
|
| 356 |
#. type: Plain text |
| 357 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 358 |
#: mageia-cauldron |
| 359 |
msgid "" |
| 360 |
"The addresses returned on Linux will usually be the IPv4 and IPv6 addresses " |
| 361 |
"assigned to the interface, but also one B<AF_PACKET> address per interface " |
| 362 |
"containing lower-level details about the interface and its physical layer. " |
| 363 |
"In this case, the I<ifa_data> field may contain a pointer to a I<struct " |
| 364 |
"rtnl_link_stats>, defined in I<E<lt>linux/if_link.hE<gt>> (in Linux 2.4 and " |
| 365 |
"earlier, I<struct net_device_stats>, defined in I<E<lt>linux/" |
| 366 |
"netdevice.hE<gt>>), which contains various interface attributes and " |
| 367 |
"statistics." |
| 368 |
msgstr "" |
| 369 |
|
| 370 |
#. type: SH |
| 371 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 372 |
#: mageia-cauldron |
| 373 |
#, no-wrap |
| 374 |
msgid "EXAMPLES" |
| 375 |
msgstr "" |
| 376 |
|
| 377 |
#. type: Plain text |
| 378 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 379 |
#: mageia-cauldron |
| 380 |
msgid "" |
| 381 |
"The program below demonstrates the use of B<getifaddrs>(), B<freeifaddrs>(), " |
| 382 |
"and B<getnameinfo>(3). Here is what we see when running this program on one " |
| 383 |
"system:" |
| 384 |
msgstr "" |
| 385 |
|
| 386 |
#. type: Plain text |
| 387 |
#: archlinux debian-unstable mageia-cauldron |
| 388 |
#, no-wrap |
| 389 |
msgid "" |
| 390 |
"$B< ./a.out>;\n" |
| 391 |
"lo AF_PACKET (17)\n" |
| 392 |
" tx_packets = 524; rx_packets = 524\n" |
| 393 |
" tx_bytes = 38788; rx_bytes = 38788\n" |
| 394 |
"wlp3s0 AF_PACKET (17)\n" |
| 395 |
" tx_packets = 108391; rx_packets = 130245\n" |
| 396 |
" tx_bytes = 30420659; rx_bytes = 94230014\n" |
| 397 |
"em1 AF_PACKET (17)\n" |
| 398 |
" tx_packets = 0; rx_packets = 0\n" |
| 399 |
" tx_bytes = 0; rx_bytes = 0\n" |
| 400 |
"lo AF_INET (2)\n" |
| 401 |
" address: E<lt>127.0.0.1E<gt>\n" |
| 402 |
"wlp3s0 AF_INET (2)\n" |
| 403 |
" address: E<lt>192.168.235.137E<gt>\n" |
| 404 |
"lo AF_INET6 (10)\n" |
| 405 |
" address: E<lt>::1E<gt>\n" |
| 406 |
"wlp3s0 AF_INET6 (10)\n" |
| 407 |
" address: E<lt>fe80::7ee9:d3ff:fef5:1a91%wlp3s0E<gt>\n" |
| 408 |
msgstr "" |
| 409 |
|
| 410 |
#. type: SS |
| 411 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 412 |
#: mageia-cauldron |
| 413 |
#, no-wrap |
| 414 |
msgid "Program source" |
| 415 |
msgstr "" |
| 416 |
|
| 417 |
#. type: Plain text |
| 418 |
#: archlinux debian-unstable mageia-cauldron |
| 419 |
#, no-wrap |
| 420 |
msgid "" |
| 421 |
"#define _GNU_SOURCE /* To get defns of NI_MAXSERV and NI_MAXHOST */\n" |
| 422 |
"#include E<lt>arpa/inet.hE<gt>\n" |
| 423 |
"#include E<lt>sys/socket.hE<gt>\n" |
| 424 |
"#include E<lt>netdb.hE<gt>\n" |
| 425 |
"#include E<lt>ifaddrs.hE<gt>\n" |
| 426 |
"#include E<lt>stdio.hE<gt>\n" |
| 427 |
"#include E<lt>stdlib.hE<gt>\n" |
| 428 |
"#include E<lt>unistd.hE<gt>\n" |
| 429 |
"#include E<lt>linux/if_link.hE<gt>\n" |
| 430 |
"\\&\n" |
| 431 |
"int main(int argc, char *argv[])\n" |
| 432 |
"{\n" |
| 433 |
" struct ifaddrs *ifaddr;\n" |
| 434 |
" int family, s;\n" |
| 435 |
" char host[NI_MAXHOST];\n" |
| 436 |
"\\&\n" |
| 437 |
" if (getifaddrs(&ifaddr) == -1) {\n" |
| 438 |
" perror(\"getifaddrs\");\n" |
| 439 |
" exit(EXIT_FAILURE);\n" |
| 440 |
" }\n" |
| 441 |
"\\&\n" |
| 442 |
" /* Walk through linked list, maintaining head pointer so we\n" |
| 443 |
" can free list later. */\n" |
| 444 |
"\\&\n" |
| 445 |
" for (struct ifaddrs *ifa = ifaddr; ifa != NULL;\n" |
| 446 |
" ifa = ifa-E<gt>ifa_next) {\n" |
| 447 |
" if (ifa-E<gt>ifa_addr == NULL)\n" |
| 448 |
" continue;\n" |
| 449 |
"\\&\n" |
| 450 |
" family = ifa-E<gt>ifa_addr-E<gt>sa_family;\n" |
| 451 |
"\\&\n" |
| 452 |
" /* Display interface name and family (including symbolic\n" |
| 453 |
" form of the latter for the common families). */\n" |
| 454 |
"\\&\n" |
| 455 |
" printf(\"%-8s %s (%d)\\[rs]n\",\n" |
| 456 |
" ifa-E<gt>ifa_name,\n" |
| 457 |
" (family == AF_PACKET) ? \"AF_PACKET\" :\n" |
| 458 |
" (family == AF_INET) ? \"AF_INET\" :\n" |
| 459 |
" (family == AF_INET6) ? \"AF_INET6\" : \"???\",\n" |
| 460 |
" family);\n" |
| 461 |
"\\&\n" |
| 462 |
" /* For an AF_INET* interface address, display the address. */\n" |
| 463 |
"\\&\n" |
| 464 |
" if (family == AF_INET || family == AF_INET6) {\n" |
| 465 |
" s = getnameinfo(ifa-E<gt>ifa_addr,\n" |
| 466 |
" (family == AF_INET) ? sizeof(struct sockaddr_in) :\n" |
| 467 |
" sizeof(struct sockaddr_in6),\n" |
| 468 |
" host, NI_MAXHOST,\n" |
| 469 |
" NULL, 0, NI_NUMERICHOST);\n" |
| 470 |
" if (s != 0) {\n" |
| 471 |
" printf(\"getnameinfo() failed: %s\\[rs]n\", gai_strerror(s));\n" |
| 472 |
" exit(EXIT_FAILURE);\n" |
| 473 |
" }\n" |
| 474 |
"\\&\n" |
| 475 |
" printf(\"\\[rs]t\\[rs]taddress: E<lt>%sE<gt>\\[rs]n\", host);\n" |
| 476 |
"\\&\n" |
| 477 |
" } else if (family == AF_PACKET && ifa-E<gt>ifa_data != NULL) {\n" |
| 478 |
" struct rtnl_link_stats *stats = ifa-E<gt>ifa_data;\n" |
| 479 |
"\\&\n" |
| 480 |
" printf(\"\\[rs]t\\[rs]ttx_packets = %10u; rx_packets = %10u\\[rs]n\"\n" |
| 481 |
" \"\\[rs]t\\[rs]ttx_bytes = %10u; rx_bytes = %10u\\[rs]n\",\n" |
| 482 |
" stats-E<gt>tx_packets, stats-E<gt>rx_packets,\n" |
| 483 |
" stats-E<gt>tx_bytes, stats-E<gt>rx_bytes);\n" |
| 484 |
" }\n" |
| 485 |
" }\n" |
| 486 |
"\\&\n" |
| 487 |
" freeifaddrs(ifaddr);\n" |
| 488 |
" exit(EXIT_SUCCESS);\n" |
| 489 |
"}\n" |
| 490 |
msgstr "" |
| 491 |
|
| 492 |
#. type: SH |
| 493 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 494 |
#: mageia-cauldron |
| 495 |
#, no-wrap |
| 496 |
msgid "SEE ALSO" |
| 497 |
msgstr "" |
| 498 |
|
| 499 |
#. type: Plain text |
| 500 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 501 |
#: mageia-cauldron |
| 502 |
msgid "" |
| 503 |
"B<bind>(2), B<getsockname>(2), B<socket>(2), B<packet>(7), B<ifconfig>(8)" |
| 504 |
msgstr "" |
| 505 |
|
| 506 |
#. type: TH |
| 507 |
#: debian-trixie |
| 508 |
#, no-wrap |
| 509 |
msgid "2024-06-15" |
| 510 |
msgstr "" |
| 511 |
|
| 512 |
#. type: TH |
| 513 |
#: debian-trixie |
| 514 |
#, no-wrap |
| 515 |
msgid "Linux man-pages 6.9.1" |
| 516 |
msgstr "" |
| 517 |
|
| 518 |
#. type: Plain text |
| 519 |
#: debian-trixie |
| 520 |
msgid "Standard C library (I<libc>, I<-lc>)" |
| 521 |
msgstr "" |
| 522 |
|
| 523 |
#. type: Plain text |
| 524 |
#: debian-trixie fedora-44 fedora-rawhide |
| 525 |
#, no-wrap |
| 526 |
msgid "" |
| 527 |
"$ B<./a.out>\n" |
| 528 |
"lo AF_PACKET (17)\n" |
| 529 |
" tx_packets = 524; rx_packets = 524\n" |
| 530 |
" tx_bytes = 38788; rx_bytes = 38788\n" |
| 531 |
"wlp3s0 AF_PACKET (17)\n" |
| 532 |
" tx_packets = 108391; rx_packets = 130245\n" |
| 533 |
" tx_bytes = 30420659; rx_bytes = 94230014\n" |
| 534 |
"em1 AF_PACKET (17)\n" |
| 535 |
" tx_packets = 0; rx_packets = 0\n" |
| 536 |
" tx_bytes = 0; rx_bytes = 0\n" |
| 537 |
"lo AF_INET (2)\n" |
| 538 |
" address: E<lt>127.0.0.1E<gt>\n" |
| 539 |
"wlp3s0 AF_INET (2)\n" |
| 540 |
" address: E<lt>192.168.235.137E<gt>\n" |
| 541 |
"lo AF_INET6 (10)\n" |
| 542 |
" address: E<lt>::1E<gt>\n" |
| 543 |
"wlp3s0 AF_INET6 (10)\n" |
| 544 |
" address: E<lt>fe80::7ee9:d3ff:fef5:1a91%wlp3s0E<gt>\n" |
| 545 |
msgstr "" |
| 546 |
|
| 547 |
#. type: Plain text |
| 548 |
#: debian-trixie fedora-44 fedora-rawhide |
| 549 |
#, no-wrap |
| 550 |
msgid "" |
| 551 |
"#define _GNU_SOURCE /* To get defns of NI_MAXSERV and NI_MAXHOST */\n" |
| 552 |
"#include E<lt>arpa/inet.hE<gt>\n" |
| 553 |
"#include E<lt>sys/socket.hE<gt>\n" |
| 554 |
"#include E<lt>netdb.hE<gt>\n" |
| 555 |
"#include E<lt>ifaddrs.hE<gt>\n" |
| 556 |
"#include E<lt>stdio.hE<gt>\n" |
| 557 |
"#include E<lt>stdlib.hE<gt>\n" |
| 558 |
"#include E<lt>unistd.hE<gt>\n" |
| 559 |
"#include E<lt>linux/if_link.hE<gt>\n" |
| 560 |
"\\&\n" |
| 561 |
"int main(int argc, char *argv[])\n" |
| 562 |
"{\n" |
| 563 |
" struct ifaddrs *ifaddr;\n" |
| 564 |
" int family, s;\n" |
| 565 |
" char host[NI_MAXHOST];\n" |
| 566 |
"\\&\n" |
| 567 |
" if (getifaddrs(&ifaddr) == -1) {\n" |
| 568 |
" perror(\"getifaddrs\");\n" |
| 569 |
" exit(EXIT_FAILURE);\n" |
| 570 |
" }\n" |
| 571 |
"\\&\n" |
| 572 |
" /* Walk through linked list, maintaining head pointer so we\n" |
| 573 |
" can free list later. */\n" |
| 574 |
"\\&\n" |
| 575 |
" for (struct ifaddrs *ifa = ifaddr; ifa != NULL;\n" |
| 576 |
" ifa = ifa-E<gt>ifa_next) {\n" |
| 577 |
" if (ifa-E<gt>ifa_addr == NULL)\n" |
| 578 |
" continue;\n" |
| 579 |
"\\&\n" |
| 580 |
" family = ifa-E<gt>ifa_addr-E<gt>sa_family;\n" |
| 581 |
"\\&\n" |
| 582 |
" /* Display interface name and family (including symbolic\n" |
| 583 |
" form of the latter for the common families). */\n" |
| 584 |
"\\&\n" |
| 585 |
" printf(\"%-8s %s (%d)\\[rs]n\",\n" |
| 586 |
" ifa-E<gt>ifa_name,\n" |
| 587 |
" (family == AF_PACKET) ? \"AF_PACKET\" :\n" |
| 588 |
" (family == AF_INET) ? \"AF_INET\" :\n" |
| 589 |
" (family == AF_INET6) ? \"AF_INET6\" : \"???\",\n" |
| 590 |
" family);\n" |
| 591 |
"\\&\n" |
| 592 |
" /* For an AF_INET* interface address, display the address. */\n" |
| 593 |
"\\&\n" |
| 594 |
" if (family == AF_INET || family == AF_INET6) {\n" |
| 595 |
" s = getnameinfo(ifa-E<gt>ifa_addr,\n" |
| 596 |
" (family == AF_INET) ? sizeof(struct sockaddr_in) :\n" |
| 597 |
" sizeof(struct sockaddr_in6),\n" |
| 598 |
" host, NI_MAXHOST,\n" |
| 599 |
" NULL, 0, NI_NUMERICHOST);\n" |
| 600 |
" if (s != 0) {\n" |
| 601 |
" printf(\"getnameinfo() failed: %s\\[rs]n\", gai_strerror(s));\n" |
| 602 |
" exit(EXIT_FAILURE);\n" |
| 603 |
" }\n" |
| 604 |
"\\&\n" |
| 605 |
" printf(\"\\[rs]t\\[rs]taddress: E<lt>%sE<gt>\\[rs]n\", host);\n" |
| 606 |
"\\&\n" |
| 607 |
" } else if (family == AF_PACKET && ifa-E<gt>ifa_data != NULL) {\n" |
| 608 |
" struct rtnl_link_stats *stats = ifa-E<gt>ifa_data;\n" |
| 609 |
"\\&\n" |
| 610 |
" printf(\"\\[rs]t\\[rs]ttx_packets = %10u; rx_packets = %10u\\[rs]n\"\n" |
| 611 |
" \"\\[rs]t\\[rs]ttx_bytes = %10u; rx_bytes = %10u\\[rs]n\",\n" |
| 612 |
" stats-E<gt>tx_packets, stats-E<gt>rx_packets,\n" |
| 613 |
" stats-E<gt>tx_bytes, stats-E<gt>rx_bytes);\n" |
| 614 |
" }\n" |
| 615 |
" }\n" |
| 616 |
"\\&\n" |
| 617 |
" freeifaddrs(ifaddr);\n" |
| 618 |
" exit(EXIT_SUCCESS);\n" |
| 619 |
"}\n" |
| 620 |
msgstr "" |
| 621 |
|
| 622 |
#. type: TH |
| 623 |
#: fedora-44 fedora-rawhide |
| 624 |
#, no-wrap |
| 625 |
msgid "2024-07-23" |
| 626 |
msgstr "" |
| 627 |
|
| 628 |
#. type: TH |
| 629 |
#: fedora-44 fedora-rawhide |
| 630 |
#, no-wrap |
| 631 |
msgid "Linux man-pages 6.13" |
| 632 |
msgstr "" |
| 633 |
|
| 634 |
#. type: TH |
| 635 |
#: mageia-cauldron |
| 636 |
#, no-wrap |
| 637 |
msgid "Linux man-pages 6.17" |
| 638 |
msgstr "" |