From 29367b1b1b2750aeda7118ed5fb9309f6a065985 Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Mon, 29 Mar 2021 16:33:07 +0900 Subject: [PATCH] LDP: Update draft based on the previous commit (net) --- manual/LDP_man-pages/draft/man1/getent.1 | 171 +++++ manual/LDP_man-pages/draft/man2/getpeername.2 | 8 +- manual/LDP_man-pages/draft/man2/shutdown.2 | 7 +- manual/LDP_man-pages/draft/man3/bswap.3 | 90 +++ manual/LDP_man-pages/draft/man3/cmsg.3 | 175 +++++ manual/LDP_man-pages/draft/man3/endian.3 | 2 +- manual/LDP_man-pages/draft/man3/getaddrinfo.3 | 26 +- manual/LDP_man-pages/draft/man3/getaddrinfo_a.3 | 21 +- manual/LDP_man-pages/draft/man3/gethostbyname.3 | 44 +- manual/LDP_man-pages/draft/man3/getnameinfo.3 | 27 +- manual/LDP_man-pages/draft/man3/getnetent.3 | 5 +- manual/LDP_man-pages/draft/man3/getprotoent.3 | 5 +- manual/LDP_man-pages/draft/man3/getprotoent_r.3 | 2 +- manual/LDP_man-pages/draft/man3/getservent.3 | 5 +- manual/LDP_man-pages/draft/man3/getservent_r.3 | 2 +- manual/LDP_man-pages/draft/man3/inet.3 | 13 +- manual/LDP_man-pages/draft/man3/inet_net_pton.3 | 2 +- manual/LDP_man-pages/draft/man3/inet_ntop.3 | 8 +- manual/LDP_man-pages/draft/man3/inet_pton.3 | 2 +- manual/LDP_man-pages/draft/man3/rcmd.3 | 207 ++++++ manual/LDP_man-pages/draft/man3/rexec.3 | 27 +- manual/LDP_man-pages/draft/man3/setnetgrent.3 | 10 +- manual/LDP_man-pages/draft/man5/gai.conf.5 | 4 +- manual/LDP_man-pages/draft/man5/host.conf.5 | 138 ++++ manual/LDP_man-pages/draft/man5/hosts.5 | 2 +- manual/LDP_man-pages/draft/man5/networks.5 | 6 +- manual/LDP_man-pages/draft/man5/nscd.conf.5 | 7 +- manual/LDP_man-pages/draft/man5/nss.5 | 2 +- manual/LDP_man-pages/draft/man5/nsswitch.conf.5 | 348 ++++++++++ manual/LDP_man-pages/draft/man5/resolv.conf.5 | 259 +++++++ manual/LDP_man-pages/draft/man7/ddp.7 | 8 +- manual/LDP_man-pages/draft/man7/hostname.7 | 110 +++ manual/LDP_man-pages/draft/man7/ip.7 | 881 ++++++++++++++++++++++++ manual/LDP_man-pages/draft/man7/ipv6.7 | 54 +- manual/LDP_man-pages/draft/man7/netdevice.7 | 5 +- manual/LDP_man-pages/draft/man7/packet.7 | 400 +++++++++++ manual/LDP_man-pages/draft/man7/raw.7 | 40 +- manual/LDP_man-pages/draft/man7/tcp.7 | 126 ++-- manual/LDP_man-pages/draft/man7/udp.7 | 3 +- manual/LDP_man-pages/draft/man7/udplite.7 | 9 +- manual/LDP_man-pages/draft/man7/unix.7 | 835 ++++++++++++++++++++++ manual/LDP_man-pages/draft/man7/x25.7 | 2 +- manual/LDP_man-pages/draft/man8/nscd.8 | 5 +- 43 files changed, 3820 insertions(+), 283 deletions(-) create mode 100644 manual/LDP_man-pages/draft/man1/getent.1 create mode 100644 manual/LDP_man-pages/draft/man3/bswap.3 create mode 100644 manual/LDP_man-pages/draft/man3/cmsg.3 create mode 100644 manual/LDP_man-pages/draft/man3/rcmd.3 create mode 100644 manual/LDP_man-pages/draft/man5/host.conf.5 create mode 100644 manual/LDP_man-pages/draft/man5/nsswitch.conf.5 create mode 100644 manual/LDP_man-pages/draft/man5/resolv.conf.5 create mode 100644 manual/LDP_man-pages/draft/man7/hostname.7 create mode 100644 manual/LDP_man-pages/draft/man7/ip.7 create mode 100644 manual/LDP_man-pages/draft/man7/packet.7 create mode 100644 manual/LDP_man-pages/draft/man7/unix.7 diff --git a/manual/LDP_man-pages/draft/man1/getent.1 b/manual/LDP_man-pages/draft/man1/getent.1 new file mode 100644 index 00000000..3d3300cd --- /dev/null +++ b/manual/LDP_man-pages/draft/man1/getent.1 @@ -0,0 +1,171 @@ +.\" Copyright (c) 2011, Mark R. Bannister +.\" Copyright (c) 2015, Robin H. Johnson +.\" +.\" %%%LICENSE_START(GPLv2+_DOC_FULL) +.\" This is free documentation; you can redistribute it and/or +.\" modify it under the terms of the GNU General Public License as +.\" published by the Free Software Foundation; either version 2 of +.\" the License, or (at your option) any later version. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.\" GNU General Public License for more details. +.\" +.\" You should have received a copy of the GNU General Public +.\" License along with this manual; if not, see +.\" . +.\" %%%LICENSE_END +.\" +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.TH GETENT 1 2020\-12\-21 Linux "User Commands" +.SH 名前 +getent \- 名前サービス切り替えライブラリからエントリーを取得する +.SH 書式 +\fBgetent\ [\fP\fIoption\fP\fB]...\ \fP\fIdatabase\fP\fB\ \fP\fIkey\fP\fB...\fP +.SH 説明 +\fBgetent\fP コマンドは、 名前サービス切り替えライブラリでサポートされているデータベースのエントリーを表示する。 +名前サービス切り替えライブラリの設定は \fI/etc/nsswitch.conf\fP で行う。 一つ以上の \fIkey\fP 引き数が指定されると、 +指定されたキーにマッチするエントリーだけが表示される。 \fIkey\fP が指定されなかった場合、 すべてのエントリーが表示される (データベースで列挙 +(enumeration) がサポートされていない場合を除く)。 +.PP +\fIdatabase\fP には GNU C ライブラリでサポートされているデータベースのいずれかを指定できる。 以下にそのリストを示す。 +.RS 3 +.TP 10 +\fBahosts\fP +\fIkey\fP が指定されなかった場合、 \fBsethostent\fP(3), \fBgethostent\fP(3), \fBendhostent\fP(3) +を使用して hosts データベースを列挙する。 これは \fBhosts\fP を使うのと全く同じである。 \fIkey\fP 引き数が一つ以上指定された場合は、 +それぞれの \fIkey\fP についてアドレスファミリー \fBAF_UNSPEC\fP で \fBgetaddrinfo\fP(3) を呼び出し、 +返された各々のソケットアドレス構造体を列挙する。 +.TP +\fBahostsv4\fP +\fBahosts\fP を同じだが、 アドレスファミリーとして \fBAF_INET\fP を使用する。 +.TP +\fBahostsv6\fP +\fBahosts\fP を同じだが、 アドレスファミリーとして \fBAF_INET6\fP を使用する。 この場合の \fBgetaddrinfo\fP(3) +の呼び出しでは \fBAI_V4MAPPED\fP も指定される。 +.TP +\fBaliases\fP +\fIkey\fP が指定されなかった場合、 \fBsetaliasent\fP(3), \fBgetaliasent\fP(3), \fBendaliasent\fP(3) +を使用して aliases データベースを列挙する。 \fIkey\fP 引き数が一つ以上指定された場合は、 それぞれの \fIkey\fP +について\fBgetaliasbyname\fP(3) を呼び出し、 結果を表示する。 +.TP +\fBethers\fP +\fIkey\fP 引き数が一つ以上指定された場合、 結果が得られるまで、 それぞれの \fIkey\fP について \fBether_aton\fP(3) と +\fBether_hostton\fP(3) を順に呼び出し、 結果を表示する。 \fBethers\fP では列挙はサポートされていない。 したがって、 +\fIkey\fP は指定しなければならない。 +.TP +\fBgroup\fP +\fIkey\fP が指定されなかった場合、 \fBsetgrent\fP(3), \fBgetgrent\fP(3), \fBendgrent\fP(3) を使用して +group データベースを列挙する。 \fIkey\fP 引き数が一つ以上指定された場合は、 それぞれの \fIkey\fP について、 数値であれば +\fBgetgrgid\fP(3) を、 数値以外であれば \fBgetgrnam\fP(3) を呼び出し、 結果を表示する。 +.TP +\fBgshadow\fP +\fIkey\fP が指定されなかった場合、 \fBsetsgent\fP(3), \fBgetsgent\fP(3), \fBendsgent\fP(3) を使用して +gshadow データベースを列挙する。 \fIkey\fP 引き数が一つ以上指定された場合は、 それぞれの \fIkey\fP について +\fBgetsgnam\fP(3) を呼び出し、 結果を表示する。 +.TP +\fBhosts\fP +\fIkey\fP が指定されなかった場合、 \fBsethostent\fP(3), \fBgethostent\fP(3), \fBendhostent\fP(3) +を使用して hosts データベースを列挙する。 \fIkey\fP 引き数が一つ以上指定された場合は、 それぞれの \fIkey\fP について +\fBgethostbyaddr\fP(3) か \fBgethostbyname2\fP(3) を呼び出し、 結果を表示する。 +\fBgethostbyaddr\fP(3) か \fBgethostbyname2\fP(3) のどちらを呼び出すかは、\fBinet_pton\fP(3) +の呼び出しで、 \fIkey\fP が IPv6 や IPv4 アドレスか、 そうでないか、 判定され、その結果によって決まる。 +.TP +\fBinitgroups\fP +\fIkey\fP 引き数が一つ以上指定された場合、 結果が得られるまで、 それぞれの \fIkey\fP について \fBgetgrouplist\fP(3) +を呼び出し、 結果を表示する。 \fBinitgroups\fP では列挙はサポートされていない。 したがって、 \fIkey\fP は指定しなければならない。 +.TP +\fBnetgroup\fP +1 個の \fIkey\fP を指定すると、 その \fIkey\fP を \fBsetnetgrent\fP(3) に渡し、 \fBgetnetgrent\fP(3) +を使って結果の 3 つ組の文字列 (\fIhostname\fP, \fIusername\fP, \fIdomainname\fP) を表示する。 代わりに、 3 個の +\fIkey\fP を指定することもできる。 3 個の \fIkey\fP は \fIhostname\fP, \fIusername\fP, \fIdomainname\fP +と解釈され、 \fBinnetgr\fP(3) を使って対応する netgroup があるか照合される。 \fBnetgroup\fP +では列挙はサポートされていない。 したがって、 1 個か 3 個のいずれかの \fIkey\fP を指定しなければならない。 +.TP +\fBnetworks\fP +\fIkey\fP が指定されなかった場合、 \fBsetnetent\fP(3), \fBgetnetent\fP(3), \fBendnetent\fP(3) を使用して +networks データベースを列挙する。 \fIkey\fP 引き数が一つ以上指定された場合は、 それぞれの \fIkey\fP について、 数値であれば +\fBgetnetbyaddr\fP(3) を、 数値以外であれば \fBgetnetbyname\fP(3) を呼び出し、 結果を表示する。 +.TP +\fBpasswd\fP +\fIkey\fP が指定されなかった場合、 \fBsetpwent\fP(3), \fBgetpwent\fP(3), \fBendpwent\fP(3) を使用して +passwd データベースを列挙する。 \fIkey\fP 引き数が一つ以上指定された場合は、 それぞれの \fIkey\fP について、 数値であれば +\fBgetpwgid\fP(3) を、 数値以外であれば \fBgetpwnam\fP(3) を呼び出し、 結果を表示する。 +.TP +\fBprotocols\fP +\fIkey\fP が指定されなかった場合、 \fBsetprotoent\fP(3), \fBgetprotoent\fP(3), \fBendprotoent\fP(3) +を使用して protocols データベースを列挙する。 \fIkey\fP 引き数が一つ以上指定された場合は、 それぞれの \fIkey\fP について、 +数値であれば \fBgetprotobynumber\fP(3) を、 数値以外であれば \fBgetprotobyname\fP(3) を呼び出し、 +結果を表示する。 +.TP +\fBrpc\fP +\fIkey\fP が指定されなかった場合、 \fBsetrpcent\fP(3), \fBgetrpcent\fP(3), \fBendrpcent\fP(3) を使用して +rpc データベースを列挙する。 \fIkey\fP 引き数が一つ以上指定された場合は、 それぞれの \fIkey\fP について、 数値であれば +\fBgetrpcbynumber\fP(3) を、 数値以外であれば \fBgetrpcbyname\fP(3) を呼び出し、 結果を表示する。 +.TP +\fBservices\fP +\fIkey\fP が指定されなかった場合、 \fBsetservent\fP(3), \fBgetservent\fP(3), \fBendservent\fP(3) +を使用して services データベースを列挙する。 \fIkey\fP 引き数が一つ以上指定された場合は、 それぞれの \fIkey\fP について、 +数値であれば \fBgetservbynumber\fP(3) を、 数値以外であれば \fBgetservbyname\fP(3) を呼び出し、 結果を表示する。 +.TP +\fBshadow\fP +\fIkey\fP が指定されなかった場合、 \fBsetspent\fP(3), \fBgetspent\fP(3), \fBendspent\fP(3) を使用して +shadow データベースを列挙する。 \fIkey\fP 引き数が一つ以上指定された場合は、 それぞれの \fIkey\fP について +\fBgetspnam\fP(3) を呼び出し、 結果を表示する。 +.RE +.SH オプション +.TP +\fB\-s\ \fP\fIservice\fP, \fB\-\-service\ \fP\fIservice\fP +.\" commit 9d0881aa76b399e6a025c5cf44bebe2ae0efa8af (glibc) +Override all databases with the specified service. (Since glibc 2.2.5.) +.TP +\fB\-s\ \fP\fIdatabase\fP\fB:\fP\fIservice\fP, \fB\-\-service\ \fP\fIdatabase\fP\fB:\fP\fIservice\fP +.\" commit b4f6f4be85d32b9c03361c38376e36f08100e3e8 (glibc) +Override only specified databases with the specified service. The option +may be used multiple times, but only the last service for each database will +be used. (Since glibc 2.4.) +.TP +\fB\-i\fP, \fB\-\-no\-idn\fP +.\" commit a160f8d808cf8020b13bd0ef4a9eaf3c11f964ad (glibc) +Disables IDN encoding in lookups for \fBahosts\fP/\fBgetaddrinfo\fP(3) (Since +glibc\-2.13.) +.TP +\fB\-?\fP, \fB\-\-help\fP +Print a usage summary and exit. +.TP +\fB\-\-usage\fP +Print a short usage summary and exit. +.TP +\fB\-V\fP, \fB\-\-version\fP +Print the version number, license, and disclaimer of warranty for \fBgetent\fP. +.SH 終了ステータス +\fBgetent\fP は以下のいずれかの終了ステータスを返す。 +.RS 3 +.TP +\fB0\fP +コマンドが正常に完了した。 +.TP +\fB1\fP +引き数が不足しているか、 知らない \fIdatabase\fP が指定された。 +.TP +\fB2\fP +指定された \fIkey\fP が \fIdatabase\fP で見つからなかった。 +.TP +\fB3\fP +この \fIdatabase\fP では列挙はサポートされていない。 +.RE +.SH 関連項目 +\fBnsswitch.conf\fP(5) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は +\%https://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/manual/LDP_man-pages/draft/man2/getpeername.2 b/manual/LDP_man-pages/draft/man2/getpeername.2 index 914a1d43..8b5da02b 100644 --- a/manual/LDP_man-pages/draft/man2/getpeername.2 +++ b/manual/LDP_man-pages/draft/man2/getpeername.2 @@ -74,7 +74,7 @@ getpeername \- 接続している相手ソケットの名前を取得する .SH エラー .TP \fBEBADF\fP -The argument \fIsockfd\fP is not a valid file descriptor. +引き数 \fIsockfd\fP が有効なファイルディスクリプターでない。 .TP \fBEFAULT\fP \fIaddr\fP 引き数の指しているメモリーが有効なプロセスのアドレス空間の 一部でない。 @@ -89,10 +89,10 @@ The argument \fIsockfd\fP is not a valid file descriptor. ソケットが接続していない。 .TP \fBENOTSOCK\fP -The file descriptor \fIsockfd\fP does not refer to a socket. +ファイルディスクリプター \fIsockfd\fP がソケットを参照していない。 .SH 準拠 -POSIX.1\-2001, POSIX.1\-2008, SVr4, 4.4BSD (\fBgetpeername\fP() first appeared -in 4.2BSD). +POSIX.1\-2001, POSIX.1\-2008, SVr4, 4.4BSD (\fBgetpeername\fP() 関数コールは 4.2BSD +で初めて登場した)。 .SH 注意 For background on the \fIsocklen_t\fP type, see \fBaccept\fP(2). .PP diff --git a/manual/LDP_man-pages/draft/man2/shutdown.2 b/manual/LDP_man-pages/draft/man2/shutdown.2 index 91112267..8883b436 100644 --- a/manual/LDP_man-pages/draft/man2/shutdown.2 +++ b/manual/LDP_man-pages/draft/man2/shutdown.2 @@ -69,7 +69,7 @@ shutdown \- 全二重接続の一部を閉じる .SH エラー .TP \fBEBADF\fP -\fIsockfd\fP is not a valid file descriptor. +\fIsockfd\fP が有効なファイルディスクリプターでない。 .TP \fBEINVAL\fP \fIhow\fP に無効な値が指定された (バグが参照)。 @@ -78,10 +78,9 @@ shutdown \- 全二重接続の一部を閉じる 指定されたソケットは接続されていない。 .TP \fBENOTSOCK\fP -The file descriptor \fIsockfd\fP does not refer to a socket. +ファイルディスクリプター \fIsockfd\fP がソケットを参照していない。 .SH 準拠 -POSIX.1\-2001, POSIX.1\-2008, 4.4BSD (\fBshutdown\fP() first appeared in -4.2BSD). +POSIX.1\-2001, POSIX.1\-2008, 4.4BSD (\fBshutdown\fP() は 4.2BSD で初めて登場した)。 .SH 注意 \fBSHUT_RD\fP, \fBSHUT_WR\fP, \fBSHUT_RDWR\fP の各定数 (それぞれ 0, 1, 2 の値を持つ) は glibc\-2.1.91 以降、 \fI\fP で定義されている。 diff --git a/manual/LDP_man-pages/draft/man3/bswap.3 b/manual/LDP_man-pages/draft/man3/bswap.3 new file mode 100644 index 00000000..036a9cf2 --- /dev/null +++ b/manual/LDP_man-pages/draft/man3/bswap.3 @@ -0,0 +1,90 @@ +.\" Copyright (C) 2016 Michael Kerrisk +.\" +.\" %%%LICENSE_START(VERBATIM) +.\" Permission is granted to make and distribute verbatim copies of this +.\" manual provided the copyright notice and this permission notice are +.\" preserved on all copies. +.\" +.\" Permission is granted to copy and distribute modified versions of this +.\" manual under the conditions for verbatim copying, provided that the +.\" entire resulting derived work is distributed under the terms of a +.\" permission notice identical to this one. +.\" +.\" Since the Linux kernel and libraries are constantly changing, this +.\" manual page may be incorrect or out-of-date. The author(s) assume no +.\" responsibility for errors or omissions, or for damages resulting from +.\" the use of the information contained herein. The author(s) may not +.\" have taken the same level of care in the production of this manual, +.\" which is licensed free of charge, as they might when working +.\" professionally. +.\" +.\" Formatted or processed versions of this manual, if unaccompanied by +.\" the source, must acknowledge the copyright and authors of this work. +.\" %%%LICENSE_END +.\" +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.TH BSWAP 3 2020\-11\-01 Linux "Linux Programmer's Manual" +.SH 名前 +bswap_16, bswap_32, bswap_64 \- reverse order of bytes +.SH 書式 +.nf +\fB#include \fP +.PP +\fBbswap_16(\fP\fIx\fP\fB);\fP +\fBbswap_32(\fP\fIx\fP\fB);\fP +\fBbswap_64(\fP\fIx\fP\fB);\fP +.fi +.SH 説明 +These macros return a value in which the order of the bytes in their 2\-, 4\-, +or 8\-byte arguments is reversed. +.SH 返り値 +These macros return the value of their argument with the bytes reversed. +.SH エラー +These macros always succeed. +.SH 準拠 +これらのマクロは GNU 拡張である。 +.SH 例 +The program below swaps the bytes of the 8\-byte integer supplied as its +command\-line argument. The following shell session demonstrates the use of +the program: +.PP +.in +4n +.EX +$ \fB./a.out 0x0123456789abcdef\fP +0x123456789abcdef ==> 0xefcdab8967452301 +.EE +.in +.SS プログラムのソース +\& +.EX +#include +#include +#include +#include +#include + +int +main(int argc, char *argv[]) +{ + uint64_t x; + + if (argc != 2) { + fprintf(stderr, "Usage: %s \en", argv[0]); + exit(EXIT_FAILURE); + } + + x = strtoull(argv[1], NULL, 0); + printf("%#" PRIx64 " ==> %#" PRIx64 "\en", x, bswap_64(x)); + + exit(EXIT_SUCCESS); +} +.EE +.SH 関連項目 +\fBbyteorder\fP(3), \fBendian\fP(3) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は +\%https://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/manual/LDP_man-pages/draft/man3/cmsg.3 b/manual/LDP_man-pages/draft/man3/cmsg.3 new file mode 100644 index 00000000..8a70c66a --- /dev/null +++ b/manual/LDP_man-pages/draft/man3/cmsg.3 @@ -0,0 +1,175 @@ +.\" This man page is Copyright (C) 1999 Andi Kleen . +.\" +.\" %%%LICENSE_START(VERBATIM_ONE_PARA) +.\" Permission is granted to distribute possibly modified copies +.\" of this page provided the header is included verbatim, +.\" and in case of nontrivial modification author and date +.\" of the modification is added to the header. +.\" %%%LICENSE_END +.\" +.\" $Id: cmsg.3,v 1.8 2000/12/20 18:10:31 ak Exp $ +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.\" +.\" Japanese Version Copyright (c) 1999 Shouichi Saito +.\" all rights reserved. +.\" Translated Mon Jul 26 21:58:26 JST 1999 +.\" by Shouichi Saito +.\" Proofed Tue Aug 17 1999 by NAKANO Takeo +.\" +.TH CMSG 3 2020\-11\-01 Linux "Linux Programmer's Manual" +.SH 名前 +CMSG_ALIGN, CMSG_SPACE, CMSG_NXTHDR, CMSG_FIRSTHDR \- 補助データにアクセスする。 +.SH 書式 +.nf +\fB#include \fP +\fBstruct cmsghdr *CMSG_FIRSTHDR(struct msghdr *\fP\fImsgh\fP\fB);\fP +\fBstruct cmsghdr *CMSG_NXTHDR(struct msghdr *\fP\fImsgh\fP\fB,\fP +\fB struct cmsghdr *\fPcmsg\fB);\fP +\fBsize_t CMSG_ALIGN(size_t \fP\fIlength\fP\fB);\fP +\fBsize_t CMSG_SPACE(size_t \fP\fIlength\fP\fB);\fP +\fBsize_t CMSG_LEN(size_t \fP\fIlength\fP\fB);\fP +\fBunsigned char *CMSG_DATA(struct cmsghdr *\fP\fIcmsg\fP\fB);\fP +.fi +.SH 説明 +これらのマクロは制御メッセージ (補助データ (ancillary data) とも呼ばれる) を作り、 それにアクセスするために使われる。 +制御メッセージはソケットにのるデータではない。 この制御情報は、到着したパケットへのインターフェイス、様々なあまり +使われないヘッダーフィールド、エラー記述の拡張、ファイルデスクリ プタの集合や、UNIXにおける信頼情報 (credential) を含んでいる。 +制御メッセージは、例えば IP オプションのような追加ヘッダーフィールドを 送るのに使う事ができる。 補助データは、 \fBsendmsg\fP(2) +を呼び出して送り、 \fBrecvmsg\fP(2) を呼び出して受け取る。 詳細はそれらのマニュアルページを参照。 +.PP +補助データは \fIcmsghdr\fP 構造体のシーケンスに追加データが付加されたものである。使用可能な制御メッセージのタイプについては、 +それぞれのプロトコルのマニュアルページを参照のこと。接続毎の最大補助用バッファーサイズは +\fI/proc/sys/net/core/optmem_max\fP を使って設定できる。 \fBsocket\fP(7) を参照。 +.PP +\fIcmsghdr\fP 構造体は以下のように定義されている。 +.PP +.in +4n +.EX +struct cmsghdr { + size_t cmsg_len; /* Data byte count, including header + (type is socklen_t in POSIX) */ + int cmsg_level; /* Originating protocol */ + int cmsg_type; /* Protocol\-specific type */ +/* followed by + unsigned char cmsg_data[]; */ +}; +.EE +.in +.PP +The sequence of \fIcmsghdr\fP structures should never be accessed directly. +Instead, use only the following macros: +.IP * 3 +\fBCMSG_FIRSTHDR\fP() returns a pointer to the first \fIcmsghdr\fP in the +ancillary data buffer associated with the passed \fImsghdr\fP. It returns NULL +if there isn't enough space for a \fIcmsghdr\fP in the buffer. +.IP * +\fBCMSG_NXTHDR\fP() は、渡した \fIcmsghdr\fP の次にくる (有効な) \fIcmsghdr\fP を返す。 +バッファーに十分な空きが無い場合、NULL を返す。 +.IP +When initializing a buffer that will contain a series of \fIcmsghdr\fP +structures (e.g., to be sent with \fBsendmsg\fP(2)), that buffer should first +be zero\-initialized to ensure the correct operation of \fBCMSG_NXTHDR\fP(). +.IP * +\fBCMSG_ALIGN\fP() に長さを与えると、必要なアラインメントを加味した長さを返してくる。 これは定数式である。 +.IP * +\fBCMSG_SPACE\fP() は、与えたデータ長が占めるのに必要な補助要素 (ancillary element) の +バイト数を返す。これは定数式である。 +.IP * +\fBCMSG_DATA\fP() returns a pointer to the data portion of a \fIcmsghdr\fP. The +pointer returned cannot be assumed to be suitably aligned for accessing +arbitrary payload data types. Applications should not cast it to a pointer +type matching the payload, but should instead use \fBmemcpy\fP(3) to copy data +to or from a suitably declared object. +.IP * +\fBCMSG_LEN\fP() は、 \fIcmsghdr\fP 構造体の \fIcmsg_len\fP +メンバにデータを格納する際に必要な値を返す。アラインメントも考慮に入れ られる。 引数としてデータ長をとる。これは定数式である。 +.PP +補助データを作るためには最初に \fImsghdr\fP のメンバー \fImsg_controllen\fP を、制御メッセージバッファーの長さで初期化する。 +\fBCMSG_FIRSTHDR\fP() を \fImsghdr\fP に用いると最初の制御メッセージが得られ、 \fBCMSG_NXTHDR\fP() +を使うと次の制御メッセージが得られる。 それぞれの制御メッセージでは、 \fIcmsg_len\fP を初期化する (\fBCMSG_LEN\fP() を使う)。 +その他の \fIcmsghdr\fP ヘッダーフィールド、そしてデータ部分に対しても \fBCMSG_DATA\fP() を使って初期化をする。 最後に +\fImsghdr\fP の \fImsg_controllen\fP フィールドに、バッファー中の制御メッセージの長さの \fBCMSG_SPACE\fP() +の合計がセットされる。 \fImsghdr\fP についての詳細は \fBrecvmsg\fP(2) を参照。 +.SH 準拠 +.\" https://www.austingroupbugs.net/view.php?id=978#c3242 +This ancillary data model conforms to the POSIX.1g draft, 4.4BSD\-Lite, the +IPv6 advanced API described in RFC\ 2292 and SUSv2. \fBCMSG_FIRSTHDR\fP(), +\fBCMSG_NXTHDR\fP(), and \fBCMSG_DATA\fP() are specified in POSIX.1\-2008. +\fBCMSG_SPACE\fP() and \fBCMSG_LEN\fP() will be included in the next POSIX +release (Issue 8). +.PP +\fBCMSG_ALIGN\fP() is a Linux extension. +.SH 注意 +移植性のために、補助データへのアクセスには、 ここで述べられているマクロだけを使うべきである。 \fBCMSG_ALIGN\fP() は Linux +での拡張であり、移植性を考えたプログラムでは使うべきではない。 +.PP +In Linux, \fBCMSG_LEN\fP(), \fBCMSG_DATA\fP(), and \fBCMSG_ALIGN\fP() are constant +expressions (assuming their argument is constant), meaning that these values +can be used to declare the size of global variables. This may not be +portable, however. +.SH 例 +次のコードは、受け取った補助バッファーから \fBIP_TTL\fP オプションを探すものである。 +.PP +.in +4n +.EX +struct msghdr msgh; +struct cmsghdr *cmsg; +int received_ttl; + +/* Receive auxiliary data in msgh */ + +for (cmsg = CMSG_FIRSTHDR(&msgh); cmsg != NULL; + cmsg = CMSG_NXTHDR(&msgh, cmsg)) { + if (cmsg\->cmsg_level == IPPROTO_IP + && cmsg\->cmsg_type == IP_TTL) { + memcpy(&receive_ttl, CMSG_DATA(cmsg), sizeof(received_ttl)); + break; + } +} + +if (cmsg == NULL) { + /* Error: IP_TTL not enabled or small buffer or I/O error */ +} +.EE +.in +.PP +以下のコードは、 \fBSCM_RIGHTS\fP を使い、ファイルディスクリプターの配列を UNIX ドメインソケットを通して送るものである。 +.PP +.in +4n +.EX +struct msghdr msg = { 0 }; +struct cmsghdr *cmsg; +int myfds[NUM_FD]; /* Contains the file descriptors to pass */ +char iobuf[1]; +struct iovec io = { + .iov_base = iobuf, + .iov_len = sizeof(iobuf) +}; +union { /* Ancillary data buffer, wrapped in a union + in order to ensure it is suitably aligned */ + char buf[CMSG_SPACE(sizeof(myfds))]; + struct cmsghdr align; +} u; + +msg.msg_iov = &io; +msg.msg_iovlen = 1; +msg.msg_control = u.buf; +msg.msg_controllen = sizeof(u.buf); +cmsg = CMSG_FIRSTHDR(&msg); +cmsg\->cmsg_level = SOL_SOCKET; +cmsg\->cmsg_type = SCM_RIGHTS; +cmsg\->cmsg_len = CMSG_LEN(sizeof(myfds)); +memcpy(CMSG_DATA(cmsg), myfds, sizeof(myfds)); +.EE +.in +.SH 関連項目 +\fBrecvmsg\fP(2), \fBsendmsg\fP(2) +.PP +RFC\ 2292 +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は +\%https://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/manual/LDP_man-pages/draft/man3/endian.3 b/manual/LDP_man-pages/draft/man3/endian.3 index 022b221c..e6b4ca17 100644 --- a/manual/LDP_man-pages/draft/man3/endian.3 +++ b/manual/LDP_man-pages/draft/man3/endian.3 @@ -114,7 +114,7 @@ NetBSD, FreeBSD, glibc では "be32toh" となる)。 一方で、これらの関数は TCP/IP 処理で使用されることを想定して 設計されたため、このページで説明している 64 ビット版や リトルエンディアン版などが存在しない。 -.SH EXAMPLES +.SH 例 以下のプログラムは、整数をホストバイトオーダーからリトルエンディアンと ビットエンディアンの両方のバイトオーダーに変換し、その結果を表示する。 ホストバイトオーダーはリトルエンディアンかビットエンディアンのいずれか diff --git a/manual/LDP_man-pages/draft/man3/getaddrinfo.3 b/manual/LDP_man-pages/draft/man3/getaddrinfo.3 index 8b982d25..b464c240 100644 --- a/manual/LDP_man-pages/draft/man3/getaddrinfo.3 +++ b/manual/LDP_man-pages/draft/man3/getaddrinfo.3 @@ -149,14 +149,12 @@ IPv6 の場合は \fBinet_pton\fP(3) でサポートされている 16 進数 \fBAI_NUMERICHOST\fP フラグが含まれている場合は、 \fInode\fP は数値形式のネットワークアドレスでなければならない。 \fBAI_NUMERICHOST\fP フラグを使うと、時間の掛かる可能性のあるネットワークホストアドレスの検索は すべて抑制される。 .PP -If the \fBAI_PASSIVE\fP flag is specified in \fIhints.ai_flags\fP, and \fInode\fP is -NULL, then the returned socket addresses will be suitable for \fBbind\fP(2)ing -a socket that will \fBaccept\fP(2) connections. The returned socket address -will contain the "wildcard address" (\fBINADDR_ANY\fP for IPv4 addresses, -\fBIN6ADDR_ANY_INIT\fP for IPv6 address). The wildcard address is used by -applications (typically servers) that intend to accept connections on any -of the host's network addresses. If \fInode\fP is not NULL, then the -\fBAI_PASSIVE\fP flag is ignored. +\fIhints.ai_flags\fP に \fBAI_PASSIVE\fP フラグが指定され、かつ \fInode\fP が NULL の場合、 +返されるソケットアドレスは コネクションを \fBaccept\fP(2) するためのソケットを \fBbind\fP(2) するのに適したものとなる。 +返されるソケットアドレスには「ワイルドカードアドレス」 (IPv4 アドレスの場合は \fBINADDR_ANY\fP、 IPv6 アドレスの場合は +\fBIN6ADDR_ANY_INIT\fP) が入る。 ワイルドカードアドレスは、任意のホストのネットワークアドレスで接続を +受け付けようとするアプリケーション (通常はサーバー) で用いられる。 \fInode\fP が NULL でない場合、 \fBAI_PASSIVE\fP +フラグは無視される。 .PP \fIhints.ai_flags\fP に \fBAI_PASSIVE\fP フラグがセットされていない場合、 返されるソケットアドレスは \fBconnect\fP(2), \fBsendto\fP(2), \fBsendmsg\fP(2) での使用に適したものとなる。 \fInode\fP が NULL @@ -326,8 +324,7 @@ T} Thread safety MT\-Safe .TE .sp 1 .SH 準拠 -POSIX.1\-2001, POSIX.1\-2008. The \fBgetaddrinfo\fP() function is documented in -RFC\ 2553. +POSIX.1\-2001, POSIX.1\-2008. \fBgetaddrinfo\fP() 関数は RFC 2553 に記載されている。 .SH 注意 \fBgetaddrinfo\fP() は、IPv6 scope\-ID を指定するために \fIaddress\fP\fB%\fP\fIscope\-id\fP 記法をサポートしている。 @@ -336,11 +333,10 @@ RFC\ 2553. \fBAI_NUMERICSERV\fP は glibc 2.3.4 以降で利用可能である。 .PP .\" POSIX.1-2001, POSIX.1-2008 -According to POSIX.1, specifying \fIhints\fP as NULL should cause \fIai_flags\fP -to be assumed as 0. The GNU C library instead assumes a value of -\fB(AI_V4MAPPED\ |\ AI_ADDRCONFIG)\fP for this case, since this value is -considered an improvement on the specification. -.SH EXAMPLES +POSIX.1 によると、 \fIhints\fP に NULL が指定された場合、 \fIai_flags\fP を 0 とみなすべきとされている。 GNU C +ライブラリでは、この場合に、代わりに \fIai_flags\fP を \fB(AI_V4MAPPED\ |\ AI_ADDRCONFIG)\fP +とみなすようになっている。 この値の方が標準規格の改善になると考えられているからである。 +.SH 例 .\" getnameinfo.3 refers to this example .\" socket.2 refers to this example .\" bind.2 refers to this example diff --git a/manual/LDP_man-pages/draft/man3/getaddrinfo_a.3 b/manual/LDP_man-pages/draft/man3/getaddrinfo_a.3 index 6b80b0e9..58033d54 100644 --- a/manual/LDP_man-pages/draft/man3/getaddrinfo_a.3 +++ b/manual/LDP_man-pages/draft/man3/getaddrinfo_a.3 @@ -122,13 +122,10 @@ struct gaicb { \fBgai_error\fP() 関数は要求 \fIreq\fP のステータスを返す。 要求がまだ完了していない場合は \fBEAI_INPROGRESS\fP が、 要求が正常に処理された場合は 0 が、 要求を解決できなかった場合はエラーコードが返される。 .PP -The \fBgai_cancel\fP() function cancels the request \fIreq\fP. If the request -has been canceled successfully, the error status of the request will be set -to \fBEAI_CANCELED\fP and normal asynchronous notification will be performed. -The request cannot be canceled if it is currently being processed; in that -case, it will be handled as if \fBgai_cancel\fP() has never been called. If -\fIreq\fP is NULL, an attempt is made to cancel all outstanding requests that -the process has made. +\fBgai_cancel\fP() 関数は要求 \fIreq\fP をキャンセルする。 要求が正常にキャンセルされた場合、 要求のエラーステータスに +\fBEAI_CANCELED\fP が設定され、 通常の非同期通知が実行される。 要求が現在処理中でキャンセルできない場合もある。 この場合 +\fBgai_cancel\fP() が呼ばれなかったかのように処理が行われる。 \fIreq\fP が NULL の場合、 +そのプロセスが行ったすべての処理中の要求をキャンセルしようとする。 .SH 返り値 \fBgetaddrinfo_a\fP() 関数はすべての要求が正常にキューに追加されると 0 を返す。 または、以下のいずれかの 0 でないエラーコードを返す。 @@ -155,11 +152,9 @@ the process has made. \fBEAI_INTR\fP シグナルが関数に割り込んだ。 この割り込みは検索要求が完了したことを示すシグナル通知により起こる場合もある。 .PP -The \fBgai_error\fP() function can return \fBEAI_INPROGRESS\fP for an unfinished -look\-up request, 0 for a successfully completed look\-up (as described -above), one of the error codes that could be returned by \fBgetaddrinfo\fP(3), -or the error code \fBEAI_CANCELED\fP if the request has been canceled -explicitly before it could be finished. +\fBgai_error\fP() 関数は、 完了していない検索要求に対して \fBEAI_INPROGRESS\fP を返し、 成功で完了した検索に対して 0 +を返す。 \fBgetaddrinfo\fP(3) が返すエラーコードのいずれかを返す場合もある。 +要求の完了前に明示的に要求がキャンセルされた場合はエラーコード \fBEAI_CANCELED\fP を返す。 .PP \fBgai_cancel\fP() 関数はこれらの値のいずれかを返すことがある。 .TP @@ -192,7 +187,7 @@ T} Thread safety MT\-Safe これらの関数は GNU 拡張である。 バージョン 2.2.3 で初めて glibc に登場した。 .SH 注意 \fBgetaddrinfo_a\fP() インターフェースは \fBlio_listio\fP(3) インターフェースの後にモデル化された。 -.SH EXAMPLES +.SH 例 ここでは二つの例を示す。 一つは複数の要求を同期処理で並行して解決する例で、 もう一つは非同期機能を使った複雑な例である。 .SS 同期型の例 以下のプログラムは単に複数のホスト名の解決を並行で行う。 \fBgetaddrinfo\fP(3) diff --git a/manual/LDP_man-pages/draft/man3/gethostbyname.3 b/manual/LDP_man-pages/draft/man3/gethostbyname.3 index 9dde6d65..3482a771 100644 --- a/manual/LDP_man-pages/draft/man3/gethostbyname.3 +++ b/manual/LDP_man-pages/draft/man3/gethostbyname.3 @@ -77,10 +77,10 @@ gethostbyname_r, gethostent_r \- ネットワーク上のホストのエント .PP \fBconst char *hstrerror(int \fP\fIerr\fP\fB);\fP .PP -/* System V/POSIX extension */ +/* System V/POSIX 拡張 */ \fBstruct hostent *gethostent(void);\fP .PP -/* GNU extensions */ +/* GNU 拡張 */ \fBstruct hostent *gethostbyname2(const char *\fP\fIname\fP\fB, int \fP\fIaf\fP\fB);\fP .PP \fBint gethostent_r(\fP @@ -110,7 +110,7 @@ glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参 \fBgethostbyname_r\fP(), \fBgethostbyname2_r\fP(): .RS 4 .TP 4 -Since glibc 2.19: +glibc 2.19 以降: _DEFAULT_SOURCE .TP 4 Glibc versions up to and including 2.19: @@ -122,7 +122,7 @@ _BSD_SOURCE || _SVID_SOURCE \fBherror\fP(), \fBhstrerror\fP(): .RS 4 .TP 4 -Since glibc 2.19: +glibc 2.19 以降: _DEFAULT_SOURCE .TP 4 Glibc 2.8 to 2.19: @@ -137,10 +137,10 @@ glibc 2.8 より前: \fBh_errno\fP: .RS 4 .TP 4 -Since glibc 2.19 +glibc 2.19 以降: _DEFAULT_SOURCE || _POSIX_C_SOURCE < 200809L .TP 4 -Glibc 2.12 to 2.19: +glibc 2.12 から 2.19 まで: _BSD_SOURCE || _SVID_SOURCE || _POSIX_C_SOURCE < 200809L .TP glibc 2.12 より前: @@ -339,29 +339,23 @@ POSIX.1\-2001 では、 \fBgethostbyname\fP(), \fBgethostbyaddr\fP(), \fBsethost .SS "System V/POSIX 拡張" .\" e.g., Linux, FreeBSD, UnixWare, HP-UX .\" e.g., FreeBSD, AIX -POSIX requires the \fBgethostent\fP() call, which should return the next entry -in the host data base. When using DNS/BIND this does not make much sense, -but it may be reasonable if the host data base is a file that can be read -line by line. On many systems, a routine of this name reads from the file -\fI/etc/hosts\fP. It may be available only when the library was built without -DNS support. The glibc version will ignore ipv6 entries. This function is -not reentrant, and glibc adds a reentrant version \fBgethostent_r\fP(). +POSIX では、 \fBgethostent\fP() が必須とされている。 この関数はホストデータベースの次のエントリーを返す。 DNS/BIND +を使う場合はあまり意味を持たないが、 ホストデータベースが 1 行ずつ読み込まれるファイルである場合は意味がある。 +多くのシステムでは、この名前のルーチンはファイル \fI/etc/hosts\fP を読み込む。 DNS +サポートなしでライブラリがビルドされた場合にのみ利用可能である。 glibc 版は ipv6 エントリーを無視する。 この関数はリエントラント +(reentrant) ではなく、 glibc にはリエントラント版の \fBgethostent_r\fP() が追加された。 .SS "GNU 拡張" glibc2 には \fBgethostbyname2\fP() もあり、 \fBgethostbyname\fP() と同じように動作するが、 こちらはアドレスが属するアドレスファミリーを指定することができる。 .PP -Glibc2 also has reentrant versions \fBgethostent_r\fP(), \fBgethostbyaddr_r\fP(), -\fBgethostbyname_r\fP(), and \fBgethostbyname2_r\fP(). The caller supplies a -\fIhostent\fP structure \fIret\fP which will be filled in on success, and a -temporary work buffer \fIbuf\fP of size \fIbuflen\fP. After the call, \fIresult\fP -will point to the result on success. In case of an error or if no entry is -found \fIresult\fP will be NULL. The functions return 0 on success and a -nonzero error number on failure. In addition to the errors returned by the -nonreentrant versions of these functions, if \fIbuf\fP is too small, the -functions will return \fBERANGE\fP, and the call should be retried with a -larger buffer. The global variable \fIh_errno\fP is not modified, but the -address of a variable in which to store error numbers is passed in -\fIh_errnop\fP. +glibc2 にはリエントラントな \fBgethostent_r\fP(), \fBgethostbyaddr_r\fP(), +\fBgethostbyname_r\fP() と \fBgethostbyname2_r\fP() もある。 呼び出し側は、成功時に結果が格納される +\fIhostent\fP 構造体 \fIret\fP と、大きさ \fIbuflen\fP の一時的な作業バッファー \fIbuf\fP を提供する。 +コール終了後、成功した場合 \fIresult\fP は結果を指している。 エラーの場合、またはエントリーが見つからなかった場合、 \fIresult\fP は +NULL になる。 これらの関数は、成功した場合 0 を返し、失敗の場合は 0 以外のエラー番号を返す。 +これらの関数のリエントラントでないバージョンが返すエラーに加えて、 これらの関数は、 \fIbuf\fP が小さすぎた場合に \fBERANGE\fP +を返す。この場合はもっと大きなバッファーを用意して 関数呼び出しを再度行うべきである。 大域変数 \fIh_errno\fP +は変更されないが、エラー番号を格納する変数のアドレスが \fIh_errnop\fP に渡される。 .SH バグ .\" http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=482973 \fBgethostbyname\fP() は、16進数表現のドット区切りの IPv4 アドレス文字列の要素を認識しない。 diff --git a/manual/LDP_man-pages/draft/man3/getnameinfo.3 b/manual/LDP_man-pages/draft/man3/getnameinfo.3 index 13f3d795..0be0bc1d 100644 --- a/manual/LDP_man-pages/draft/man3/getnameinfo.3 +++ b/manual/LDP_man-pages/draft/man3/getnameinfo.3 @@ -37,8 +37,8 @@ glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参 .RE .PP \fBgetnameinfo\fP(): - Since glibc 2.22: _POSIX_C_SOURCE >= 200112L - Glibc 2.21 and earlier: _POSIX_C_SOURCE + glibc 2.22 以降: _POSIX_C_SOURCE >= 200112L + glibc 2.21 以前: _POSIX_C_SOURCE .ad b .SH 説明 \fBgetnameinfo\fP() 関数は、 \fBgetaddrinfo\fP(3) の逆の動作を行う。つまり、プロトコルに依存しないかたちで @@ -46,12 +46,10 @@ glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参 \fBgetservbyport\fP(3) の機能を一つにしたものだが、 これらの関数と違い、 \fBgetnameinfo\fP(3) はリエントラントであり、IPv4 と IPv6 の差分に依存しないかたちで プログラムを書くことができる。 .PP -The \fIaddr\fP argument is a pointer to a generic socket address structure (of -type \fIsockaddr_in\fP or \fIsockaddr_in6\fP) of size \fIaddrlen\fP that holds the -input IP address and port number. The arguments \fIhost\fP and \fIserv\fP are -pointers to caller\-allocated buffers (of size \fIhostlen\fP and \fIservlen\fP -respectively) into which \fBgetnameinfo\fP() places null\-terminated strings -containing the host and service names respectively. +\fIaddr\fP 引き数は、 IP アドレスとポート番号の情報を保持している 汎用的なソケットアドレス構造体 (\fIsockaddr_in\fP 型または +\fIsockaddr_in6\fP 型) へのポインターである。 \fIaddrlen\fP は \fIaddr\fP のサイズである。 \fIhost\fP と +\fIserv\fP 引き数は、(それぞれサイズが \fIhostlen\fP と \fIservlen\fP の) +呼び出し側で確保されたバッファーへのポインターであり、 ホスト名とサービス名を含むヌル終端された文字列が それぞれのバッファーに格納される。 .PP ホスト名が不要であることをこの関数に伝えるには、 \fIhost\fP に NULL を指定するか、 \fIhostlen\fP に 0 を指定する。同様に、サービス名が不要な場合は、 \fIserv\fP に NULL を指定するか、 \fIservlen\fP に 0 を指定する。 @@ -63,9 +61,8 @@ containing the host and service names respectively. 指定すると、ホスト名が決定できなかった場合にエラーを返す。 .TP \fBNI_DGRAM\fP -If set, then the service is datagram (UDP) based rather than stream (TCP) -based. This is required for the few ports (512\(en514) that have different -services for UDP and TCP. +指定すると、ストリームベース (TCP) でなくデータグラムベース (UDP) のサービスを対象にする。数は少ないが、 UDP と TCP +で違うサービスを提供しているポート (512\(en514) に対して必要となる。 .TP \fBNI_NOFQDN\fP 指定すると、ローカルなホストには fully qualified domain name (FQDN) の ホスト名の部分のみを返す。 @@ -107,10 +104,8 @@ Domain Name; IDN) 形式との間で 透過的な変換ができるようにな .\" #define EAI_INTR -104 /* Interrupted by a signal. */ .\" #define EAI_IDN_ENCODE -105 /* IDN encoding failed. */ .\" #endif -On success, 0 is returned, and node and service names, if requested, are -filled with null\-terminated strings, possibly truncated to fit the specified -buffer lengths. On error, one of the following nonzero error codes is -returned: +成功すると 0 が返り、(要求されていれば) ノードとサービスの名前がヌル終端された文字列の形式でそれぞれの指定バッファーに返される +(バッファーの長さにあうように縮められるかもしれない)。 エラーの場合は、以下の 0 以外のエラーコードが返される: .TP \fBEAI_AGAIN\fP 指定された名前が現時点では解決できなかった。 後で再試行してみること。 @@ -179,7 +174,7 @@ macros are defined, namely: \fB_GNU_SOURCE\fP, \fB_DEFAULT_SOURCE\fP (since glib と同じ値である。 後者は、割り当て済の数値について記した現在の RFC に 列挙されてサービスから推量した値である。 .PP glibc バージョン 2.2 より前では、 引き数 \fIhostlen\fP, \fIservlen\fP の型は \fIsize_t\fP であった。 -.SH EXAMPLES +.SH 例 以下のコードは、指定されたソケットアドレスに対する ホストとサービスの数値表式を取得しようと試みる。 特定のアドレスファミリーに対する参照情報は 一切ハードコードされていないことに着目してほしい。 .PP diff --git a/manual/LDP_man-pages/draft/man3/getnetent.3 b/manual/LDP_man-pages/draft/man3/getnetent.3 index 803ff12e..b140e8fb 100644 --- a/manual/LDP_man-pages/draft/man3/getnetent.3 +++ b/manual/LDP_man-pages/draft/man3/getnetent.3 @@ -98,9 +98,8 @@ struct netent { \fIn_net\fP ホストバイトオーダ形式のネットワーク番号。 .SH 返り値 -The \fBgetnetent\fP(), \fBgetnetbyname\fP(), and \fBgetnetbyaddr\fP() functions -return a pointer to a statically allocated \fInetent\fP structure, or a null -pointer if an error occurs or the end of the file is reached. +\fBgetnetent\fP(), \fBgetnetbyname\fP(), \fBgetnetbyaddr\fP() 関数は、静的に割り当てられた +\fInetent\fP 構造体へのポインターを返す。 エラーが起こったり、ファイルの末尾に達した場合はヌルポインターを返す。 .SH ファイル .TP \fI/etc/networks\fP diff --git a/manual/LDP_man-pages/draft/man3/getprotoent.3 b/manual/LDP_man-pages/draft/man3/getprotoent.3 index 5d0dfaa7..6b16dfb8 100644 --- a/manual/LDP_man-pages/draft/man3/getprotoent.3 +++ b/manual/LDP_man-pages/draft/man3/getprotoent.3 @@ -93,9 +93,8 @@ struct protoent { \fIp_proto\fP プロトコルの番号 .SH 返り値 -The \fBgetprotoent\fP(), \fBgetprotobyname\fP(), and \fBgetprotobynumber\fP() -functions return a pointer to a statically allocated \fIprotoent\fP structure, -or a null pointer if an error occurs or the end of the file is reached. +\fBgetprotoent\fP(), \fBgetprotobyname\fP(), \fBgetprotobynumber\fP() 関数は、静的に割り当てられた +\fIprotoent\fP 構造体へのポインターを返す。 エラーが起こったり、ファイルの最後に達した場合は NULL を返す。 .SH ファイル .PD 0 .TP diff --git a/manual/LDP_man-pages/draft/man3/getprotoent_r.3 b/manual/LDP_man-pages/draft/man3/getprotoent_r.3 index 037da5e2..6f097f8f 100644 --- a/manual/LDP_man-pages/draft/man3/getprotoent_r.3 +++ b/manual/LDP_man-pages/draft/man3/getprotoent_r.3 @@ -127,7 +127,7 @@ T} Thread safety MT\-Safe locale これらの関数は GNU による拡張である。 他のシステムにも同様の名前の関数が存在する場合があるが、 通常は関数の引き数が異なる。 -.SH EXAMPLES +.SH 例 以下のプログラムは、 \fBgetprotobyname_r\fP() を使って、最初のコマンド ライン引き数で指定された名前のプロトコルのレコードを取得する。 二番目のコマンドライン引き数 (整数値) が指定された場合は、 diff --git a/manual/LDP_man-pages/draft/man3/getservent.3 b/manual/LDP_man-pages/draft/man3/getservent.3 index af64eb66..6f278ccf 100644 --- a/manual/LDP_man-pages/draft/man3/getservent.3 +++ b/manual/LDP_man-pages/draft/man3/getservent.3 @@ -105,9 +105,8 @@ struct servent { \fIs_proto\fP このサービスと共に用いるプロトコルの名前。 .SH 返り値 -The \fBgetservent\fP(), \fBgetservbyname\fP(), and \fBgetservbyport\fP() functions -return a pointer to a statically allocated \fIservent\fP structure, or NULL if -an error occurs or the end of the file is reached. +\fBgetservent\fP(), \fBgetservbyname\fP(), \fBgetservbyport\fP() 関数は、 静的に割り当てられた +\fIservent\fP 構造体へのポインターを返す。 エラーが起こったり、ファイルの末尾に達した場合は NULL を返す。 .SH ファイル .TP \fI/etc/services\fP diff --git a/manual/LDP_man-pages/draft/man3/getservent_r.3 b/manual/LDP_man-pages/draft/man3/getservent_r.3 index a44ea503..96922e43 100644 --- a/manual/LDP_man-pages/draft/man3/getservent_r.3 +++ b/manual/LDP_man-pages/draft/man3/getservent_r.3 @@ -125,7 +125,7 @@ T} Thread safety MT\-Safe locale これらの関数は GNU による拡張である。 他のシステムにも同様の名前の関数が存在する場合があるが、 通常は関数の引き数が異なる。 -.SH EXAMPLES +.SH 例 以下のプログラムは、 \fBgetservbyport_r\fP() を使って、コマンド ライン引き数で指定されたポート番号とプロトコル名を持つ サービスレコードを取得する。 diff --git a/manual/LDP_man-pages/draft/man3/inet.3 b/manual/LDP_man-pages/draft/man3/inet.3 index 026943d6..cf9c78a2 100644 --- a/manual/LDP_man-pages/draft/man3/inet.3 +++ b/manual/LDP_man-pages/draft/man3/inet.3 @@ -139,9 +139,8 @@ notation)\fP と呼ぶこともある)。 ネットワーク番号 \fInet\fP と、ローカルアドレス \fIhost\fP を 組み合わせて生成した、インターネットホストアドレスを ネットワークバイトオーダで返す。 \fIhost\fP, \fInet\fP はともにホストバイトオーダである。 .PP -The structure \fIin_addr\fP as used in \fBinet_ntoa\fP(), \fBinet_makeaddr\fP(), -\fBinet_lnaof\fP(), and \fBinet_netof\fP() is defined in -\fI\fP as: +\fBinet_ntoa\fP(), \fBinet_makeaddr\fP(), \fBinet_lnaof\fP(), \fBinet_netof\fP() +で使用する構造体 \fIin_addr\fP は \fI\fP で次のように定義されている: .PP .in +4n .EX @@ -179,9 +178,9 @@ T} Thread safety MT\-Safe \fBinet_aton\fP() is not specified in POSIX.1, but is available on most systems. .SH 注意 -On x86 architectures, the host byte order is Least Significant Byte first -(little endian), whereas the network byte order, as used on the Internet, is -Most Significant Byte first (big endian). +x86 アーキテクチャーではホストバイトオーダは Least Significant Byte (LSB) first (リトルエンディアン) だが、 +インターネットで使われるネットワークバイトオーダは Most Significant Byte (MSB) first (ビッグエンディアン) +である点に注意すること。 .PP \fBinet_lnaof\fP(), \fBinet_netof\fP(), \fBinet_makeaddr\fP() は過去の名残であり、渡されたアドレスが \fIクラスフルネットワークアドレス (classful network addresses)\fP であると仮定して処理を行う。 @@ -201,7 +200,7 @@ Class C .PP クラスフルネットワークアドレスは現在では廃止され、 クラスレスドメイン間ルーチン (CIDR) に取って代わられた。 CIDR では、アドレスを任意のビット境界 (バイト境界ではない) で ネットワーク部とホスト部に分割する。 -.SH EXAMPLES +.SH 例 以下は \fBinet_aton\fP() と \fBinet_ntoa\fP() の使用例である。このように実行する。 .PP .in +4n diff --git a/manual/LDP_man-pages/draft/man3/inet_net_pton.3 b/manual/LDP_man-pages/draft/man3/inet_net_pton.3 index 9534636e..29b8de66 100644 --- a/manual/LDP_man-pages/draft/man3/inet_net_pton.3 +++ b/manual/LDP_man-pages/draft/man3/inet_net_pton.3 @@ -139,7 +139,7 @@ NULL 終端された表記形式の文字列は \fIpres\fP が指すバッファ .PP 上記の手順から得られる \fIbits\fP の値が 8 以上だが、 ネットワーク番号で指定されたオクテット数が \fIbits/8\fP より大きい場合、 \fIbits\fP には実際に指定されたオクテット数を 8 倍した値が設定される。 -.SH EXAMPLES +.SH 例 以下のプログラムは \fBinet_net_pton\fP() と \fBinet_net_ntop\fP() の使用例を示すものである。 \fBinet_net_pton\fP() を使って、 コマンドラインの最初の引き数で渡された表記形式のネットワークアドレスをバイナリー形式に変換し、 \fIinet_net_pton\fP() の返り値を出力する。 それから \fBinet_net_ntop\fP() diff --git a/manual/LDP_man-pages/draft/man3/inet_ntop.3 b/manual/LDP_man-pages/draft/man3/inet_ntop.3 index 37eae3cf..27b4a904 100644 --- a/manual/LDP_man-pages/draft/man3/inet_ntop.3 +++ b/manual/LDP_man-pages/draft/man3/inet_ntop.3 @@ -86,12 +86,12 @@ T} Thread safety MT\-Safe locale .sp 1 .SH 準拠 .\" 2.1.3: size_t, 2.1.91: socklen_t -POSIX.1\-2001, POSIX.1\-2008. Note that RFC\ 2553 defines a prototype where -the last argument \fIsize\fP is of type \fIsize_t\fP. Many systems follow RFC\ 2553. Glibc 2.0 and 2.1 have \fIsize_t\fP, but 2.2 and later have -\fIsocklen_t\fP. +POSIX.1\-2001. POSIX.1\-2008, RFC\ 2553 では最後の引き数 \fIsize\fP のプロトタイプを \fIsize_t\fP +型と定義している。多くのシステムでは RFC\ 2553 にしたがっている。 glibc 2.0 と 2.1 では \fIsize_t\fP だが、 +glibc 2.2 以降では \fIsocklen_t\fP となっている。 .SH バグ \fBAF_INET6\fP は IPv4 がマップされた IPv6 アドレスを IPv6 形式に変換してしまう。 -.SH EXAMPLES +.SH 例 \fBinet_pton\fP(3) を参照。 .SH 関連項目 \fBgetnameinfo\fP(3), \fBinet\fP(3), \fBinet_pton\fP(3) diff --git a/manual/LDP_man-pages/draft/man3/inet_pton.3 b/manual/LDP_man-pages/draft/man3/inet_pton.3 index 24baaea8..82e741dd 100644 --- a/manual/LDP_man-pages/draft/man3/inet_pton.3 +++ b/manual/LDP_man-pages/draft/man3/inet_pton.3 @@ -102,7 +102,7 @@ POSIX.1\-2001, POSIX.1\-2008. .SH バグ \fBAF_INET6\fP は IPv4 アドレスを認識しない。 代わりに IPv4 アドレスをマッピングした IPv6 アドレスを \fIsrc\fP に与えなければならない。 -.SH EXAMPLES +.SH 例 以下のプログラムは \fBinet_pton\fP() と \fBinet_ntop\fP(3) の使用例を示すものである。 実行すると以下のようになる。 .PP .in +4n diff --git a/manual/LDP_man-pages/draft/man3/rcmd.3 b/manual/LDP_man-pages/draft/man3/rcmd.3 new file mode 100644 index 00000000..3a948af5 --- /dev/null +++ b/manual/LDP_man-pages/draft/man3/rcmd.3 @@ -0,0 +1,207 @@ +.\" $NetBSD: rcmd.3,v 1.9 1996/05/28 02:07:39 mrg Exp $ +.\" +.\" Copyright (c) 1983, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" %%%LICENSE_START(BSD_4_CLAUSE_UCB) +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" %%%LICENSE_END +.\" +.\" @(#)rcmd.3 8.1 (Berkeley) 6/4/93 +.\" +.\" Contributed as Linux man page by David A. Holland, 970908 +.\" I have not checked whether the Linux situation is exactly the same. +.\" +.\" 2007-12-08, mtk, Converted from mdoc to man macros +.\" +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.\" +.\" Japanese Version Copyright (c) 1999 NAKANO Takeo all rights reserved. +.\" Translated Mon Mar 1 1999 by NAKANO Takeo +.\" Updated 2012-04-30, Akihiro MOTOKI +.\" Updated 2012-05-05, Akihiro MOTOKI +.\" +.TH RCMD 3 2020\-12\-21 Linux "Linux Programmer's Manual" +.SH 名前 +rcmd, rresvport, iruserok, ruserok, rcmd_af, rresvport_af, iruserok_af, +ruserok_af \- リモートコマンドにストリームを返す関数群 +.SH 書式 +.nf +\fB#include \ \ \fP/* Or on some systems */ +.PP +\fBint rcmd(char **\fP\fIahost\fP\fB, unsigned short \fP\fIinport\fP\fB, const char *\fP\fIlocuser\fP\fB,\fP +\fB const char *\fP\fIremuser\fP\fB, const char *\fP\fIcmd\fP\fB, int *\fP\fIfd2p\fP\fB);\fP +.PP +\fBint rresvport(int *\fP\fIport\fP\fB);\fP +.PP +\fBint iruserok(uint32_t \fP\fIraddr\fP\fB, int \fP\fIsuperuser\fP\fB,\fP +\fB const char *\fP\fIruser\fP\fB, const char *\fP\fIluser\fP\fB);\fP +.PP +\fBint ruserok(const char *\fP\fIrhost\fP\fB, int \fP\fIsuperuser\fP\fB,\fP +\fB const char *\fP\fIruser\fP\fB, const char *\fP\fIluser\fP\fB);\fP +.PP +\fBint rcmd_af(char **\fP\fIahost\fP\fB, unsigned short \fP\fIinport\fP\fB, const char *\fP\fIlocuser\fP\fB,\fP +\fB const char *\fP\fIremuser\fP\fB, const char *\fP\fIcmd\fP\fB, int *\fP\fIfd2p\fP\fB,\fP +\fB sa_family_t \fP\fIaf\fP\fB);\fP +.PP +\fBint rresvport_af(int *\fP\fIport\fP\fB, sa_family_t \fP\fIaf\fP\fB);\fP +.PP +\fBint iruserok_af(const void *\fP\fIraddr\fP\fB, int \fP\fIsuperuser\fP\fB,\fP +\fB const char *\fP\fIruser\fP\fB, const char *\fP\fIluser\fP\fB, sa_family_t \fP\fIaf\fP\fB);\fP +.PP +\fBint ruserok_af(const char *\fP\fIrhost\fP\fB, int \fP\fIsuperuser\fP\fB,\fP +\fB const char *\fP\fIruser\fP\fB, const char *\fP\fIluser\fP\fB, sa_family_t \fP\fIaf\fP\fB);\fP +.fi +.PP +.RS -4 +glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): +.RE +.PP +\fBrcmd\fP(), +\fBrcmd_af\fP(), +\fBrresvport\fP(), +\fBrresvport_af\fP(), +\fBiruserok\fP(), +\fBiruserok_af\fP(), +\fBruserok\fP(), +\fBruserok_af\fP(): + Since glibc 2.19: + _DEFAULT_SOURCE + Glibc 2.19 and earlier: + _BSD_SOURCE +.SH 説明 +\fBrcmd\fP() 関数は、スーパーユーザーがリモートマシンでコマンドを実行するために 用いられる。このとき特権ポート番号をもとにした認証スキームが +用いられる。 \fBrresvport\fP() 関数は、特権ポート空間のアドレスを持つソケットのファイルディスクリプターを返す。 \fBiruserok\fP() +関数と \fBruserok\fP() 関数は、 \fBrcmd\fP() でサービス要求を行ったクライアントの認証を行うために サーバーが用いる関数である。 +以上の 4 つの関数は、 \fBrshd\fP(8) サーバーによって (他の関数とともに) 利用される。 +.SS rcmd() +\fBrcmd\fP() 関数は \fBgethostbyname\fP(3) を用いて \fI*ahost\fP の参照を行う。ホストが存在しない場合は \-1 +を返す。 見つかった場合は \fI*ahost\fP にホストの標準名 (standard name) をセットして、 予約されているインターネットポート +\fIinport\fP 経由でサーバーへの接続を確立する。 +.PP +接続に成功したら、インターネットドメインに存在するタイプ \fBSOCK_STREAM\fP のソケットが呼び出しもとに返される。 +このソケットの相手側はリモートコマンドの \fIstdin\fP および \fIstdout\fP に接続される。 \fIfd2p\fP +がゼロでない場合は、制御プロセスへの接続がもう一つ用意され、 そのファイルディスクリプターが \fI*fd2p\fP にセットされる。 +制御プロセスはリモートコマンドからの標準エラー出力 (unit 2) を このチャンネルに返す。 また制御プロセスはこの接続から受け取ったバイトデータを +UNIX シグナルの番号として扱い、リモートコマンドのプロセス グループへとシグナルを送る。 \fIfd2p\fP がゼロの場合は、 \fIstderr\fP +(リモートコマンドの unit 2) は \fIstdout\fP と一緒にまとめられる。またこの場合はリモートプロセスへ +任意のシグナルを送ることはできなくなる。 ただし帯域外 (out\-of\-band) データを用いれば、 +リモートプロセスの注意を引くことはできるかもしれない。 +.PP +プロトコルの詳細は \fBrshd\fP(8) に記述されている。 +.SS rresvport() +.\" +The \fBrresvport\fP() function is used to obtain a socket with a privileged +port bound to it. This socket is suitable for use by \fBrcmd\fP() and several +other functions. Privileged ports are those in the range 0 to 1023. Only a +privileged process (on Linux: a process that has the \fBCAP_NET_BIND_SERVICE\fP +capability in the user namespace governing its network namespace). is +allowed to bind to a privileged port. In the glibc implementation, this +function restricts its search to the ports from 512 to 1023. The \fIport\fP +argument is value\-result: the value it supplies to the call is used as the +starting point for a circular search of the port range; on (successful) +return, it contains the port number that was bound to. +.SS "iruserok() と ruserok()" +\fBiruserok\fP() と \fBruserok\fP() 関数は、まず以下の引数を取る: リモートホスト (\fBiruserok\fP() は IP +アドレスで、 \fBruserok\fP() はホスト名で指定)、 2 つのユーザー名、ローカルユーザーの名前が +スーパーユーザーのものであるかどうかを示すフラグ、である。 もしユーザーが\fBスーパーユーザーではない\fP場合は、これらの関数は +\fI/etc/hosts.equiv\fP ファイルをチェックする。ファイルが見つからなかったり、 内容のチェックに失敗した場合には、 +ローカルユーザーのホームディレクトリにある \fI.rhosts\fP ファイルをチェックして、サービス要求が許可されているかどうか調べる。 +.PP +If this file does not exist, is not a regular file, is owned by anyone other +than the user or the superuser, is writable by anyone other than the owner, +or is hardlinked anywhere, the check automatically fails. Zero is returned +if the machine name is listed in the \fIhosts.equiv\fP file, or the host and +remote username are found in the \fI.rhosts\fP file; otherwise \fBiruserok\fP() +and \fBruserok\fP() return \-1. If the local domain (as obtained from +\fBgethostname\fP(2)) is the same as the remote domain, only the machine name +need be specified. +.PP +リモートホストの IP アドレスがわかっている場合は、 \fBruserok\fP() よりも \fBiruserok\fP()\fBを用いる方が良いだろう。\fP +\fBruserok\fP() はリモートホストの所属するドメインの DNS サーバーが信頼できなくても 使用できるからである。 +.SS "*_af() 版" +上記で述べた関数は全て IPv4 (\fBAF_INET\fP) ソケットで動作する。 +"_af" 版では追加の引き数があり、この引き数でソケットアドレス +ファミリーを指定できる。これらの関数では、 \fIaf\fP 引き数には +\fBAF_INET\fP か \fBAF_INET6\fP が指定できる。 +\fBrcmd_af\fP() では追加で \fBAF_UNSPEC\fP も指定できる。 +.SH 返り値 +\fBrcmd\fP() 関数は成功すると有効なソケットディスクリプターを返す。 失敗すると \-1 を返し、標準エラー出力に診断メッセージを 表示する。 +.PP +\fBrresvport\fP() 関数は、成功するとバインドされた有効なソケットディスクリプターを返す。 失敗すると \-1 を返し、グローバル変数 +\fIerrno\fP をエラーの原因に対応する値にセットする。 エラーコード \fBEAGAIN\fP +は、この関数においては「すべてのネットワークポートが使用中」 という意味を表す。 +.PP +\fBruserok\fP() と \fBiruserok\fP() の返り値については、上述の説明を参照。 +.SH バージョン +関数 \fBiruserok_af\fP(), \fBrcmd_af\fP(), \fBrresvport_af\fP(), +\fBruserok_af\fP() は glibc バージョン 2.2 以降で提供されている。 +.SH 属性 +この節で使用されている用語の説明は \fBattributes\fP(7) を参照のこと。 +.TS +allbox; +lbw27 lb lb +l l l. +Interface Attribute Value +T{ +\fBrcmd\fP(), +\fBrcmd_af\fP() +T} Thread safety MT\-Unsafe +T{ +\fBrresvport\fP(), +\fBrresvport_af\fP() +T} Thread safety MT\-Safe +T{ +\fBiruserok\fP(), +\fBruserok\fP(), +.br +\fBiruserok_af\fP(), +\fBruserok_af\fP() +T} Thread safety MT\-Safe locale +.TE +.sp 1 +.SH 準拠 +POSIX.1 にはない。 BSD 系、Solaris や他の多くのシステムに存在する。 +これらの関数は 4.2BSD で登場した。 "_af" が付くバージョンはより最近に +追加されたもので、あまり多くのシステムには存在しない。 +.SH バグ +.\" Bug filed 25 Nov 2007: +.\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=5399 +\fBiruserok\fP() と \fBiruserok_af\fP() は glibc バージョン 2.12 以降のヘッダー +でのみ宣言されている。 +.SH 関連項目 +\fBrlogin\fP(1), \fBrsh\fP(1), \fBrexec\fP(3), \fBrexecd\fP(8), \fBrlogind\fP(8), +\fBrshd\fP(8) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は +\%https://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/manual/LDP_man-pages/draft/man3/rexec.3 b/manual/LDP_man-pages/draft/man3/rexec.3 index 8813312a..fc25237e 100644 --- a/manual/LDP_man-pages/draft/man3/rexec.3 +++ b/manual/LDP_man-pages/draft/man3/rexec.3 @@ -84,19 +84,14 @@ rexec, rexec_af \- リモートコマンドへのストリームを返す 参照)、この構造体には必要なポートが入っている。 接続に使用されるプロトコルについての詳細は \fBrexecd\fP(8) に書かれている (訳注: 現在のところ存在しない)。 .PP -If the connection succeeds, a socket in the Internet domain of type -\fBSOCK_STREAM\fP is returned to the caller, and given to the remote command as -\fIstdin\fP and \fIstdout\fP. If \fIfd2p\fP is nonzero, then an auxiliary channel to -a control process will be setup, and a file descriptor for it will be placed -in \fI*fd2p\fP. The control process will return diagnostic output from the -command (unit 2) on this channel, and will also accept bytes on this channel -as being UNIX signal numbers, to be forwarded to the process group of the -command. The diagnostic information returned does not include remote -authorization failure, as the secondary connection is set up after -authorization has been verified. If \fIfd2p\fP is 0, then the \fIstderr\fP (unit -2 of the remote command) will be made the same as the \fIstdout\fP and no -provision is made for sending arbitrary signals to the remote process, -although you may be able to get its attention by using out\-of\-band data. +接続に成功すると、インターネットドメインの \fBSOCK_STREAM\fP 型のソケットが返され、そのソケットはリモートコマンドの +標準入力および標準出力となる。 \fIfd2p\fP が 0 以外の場合、制御プロセスへの補助チャンネルがセットアップされ、 +補助チャンネルのファイルディスクリプターが \fI*fd2p\fP に書かれる。 制御プロセスはコマンドからの診断メッセージ出力 (ファイルディスクリプター +2) をこのチャンネルで返す。また、このチャンネル経由で UNIX のシグナル番号を示すバイトを受信する。受信したシグナルは +コマンドが属すプロセスグループに転送される。 診断情報にはリモートの認証失敗は含まれない。なぜなら、認証の確認が行われた +後で補助チャンネルの接続はセットアップされるからである。 \fIfd2p\fP が 0 の場合、標準エラー (リモートコマンドのファイルディスクリプター 2) +は 標準出力と同様に扱われ、リモートプロセスに任意のシグナルを送るための 手段は提供されない。但し、リモートプロセスに対してトリガーをかけるために、 +帯域外データ (out\-of\-band data) を使うことはできる。 .SS rexec_af() \fBrexec\fP() 関数は IPv4 (\fBAF_INET\fP) 上で動作する。 これに対して、 \fBrexec_af\fP() 関数は追加の引き数 \fIaf\fP があり、 @@ -118,9 +113,9 @@ T{ T} Thread safety MT\-Unsafe .TE .SH 準拠 -These functions are not in POSIX.1. The \fBrexec\fP() function first appeared -in 4.2BSD, and is present on the BSDs, Solaris, and many other systems. The -\fBrexec_af\fP() function is more recent, and less widespread. +これらの関数は POSIX.1 にはない。\fBrexec\fP() 関数は 4.2BSD で始めて +登場し、BSD 系、Solaris や他の多くのシステムに存在する。\fBrexec_af\fP() +関数はもっと新しく、それほど広く使われているわけではない。 .SH バグ \fBrexec\fP() 関数はネットワークに暗号化されていないパスワードを送信する。 .PP diff --git a/manual/LDP_man-pages/draft/man3/setnetgrent.3 b/manual/LDP_man-pages/draft/man3/setnetgrent.3 index 74ae5a28..bf82c184 100644 --- a/manual/LDP_man-pages/draft/man3/setnetgrent.3 +++ b/manual/LDP_man-pages/draft/man3/setnetgrent.3 @@ -48,9 +48,9 @@ glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参 \fBgetnetgrent\fP(), \fBgetnetgrent_r\fP(), \fBinnetgr\fP(): - Since glibc 2.19: + glibc 2.19 以降: _DEFAULT_SOURCE - Glibc 2.19 and earlier: + glibc 2.19 以前: _BSD_SOURCE || _SVID_SOURCE .ad b .SH 説明 @@ -112,9 +112,9 @@ the functions \fBsetnetgrent\fP(), \fBgetnetgrent_r\fP(), \fBinnetgr\fP(), threads of a program, then data races could occur. .SH 準拠 .\" getnetgrent_r() is on Solaris 8 and AIX 5.1, but not the BSDs. -These functions are not in POSIX.1, but \fBsetnetgrent\fP(), \fBendnetgrent\fP(), -\fBgetnetgrent\fP(), and \fBinnetgr\fP() are available on most UNIX systems. -\fBgetnetgrent_r\fP() is not widely available on other systems. +これらの関数は POSIX.1 にはないが、 setnetgrent (), endnetgrent (), getnetgrent (), +innetgr () はほとんどの UNIX システムで利用可能である。 \fBgetnetgrent_r\fP() +は広く他のシステムで利用できるわけではない。 .SH 注意 BSD の実装では \fBsetnetgrent\fP() は void を返す。 .SH 関連項目 diff --git a/manual/LDP_man-pages/draft/man5/gai.conf.5 b/manual/LDP_man-pages/draft/man5/gai.conf.5 index 5f231a81..8bdbcac3 100644 --- a/manual/LDP_man-pages/draft/man5/gai.conf.5 +++ b/manual/LDP_man-pages/draft/man5/gai.conf.5 @@ -64,8 +64,8 @@ IPv4 アドレス用の RFC\ 3484 スコープテーブルに別のルールを \fI/etc/gai.conf\fP .SH バージョン .\" Added in 2006 -The \fIgai.conf\fP file is supported by glibc since version 2.5. -.SH EXAMPLES +\fIgai.conf\fP ファイルは glibc バージョン 2.5 以降でサポートされている。 +.SH 例 RFC\ 3484 で規定されているデフォルトテーブルは、 以下の設定ファイルを指定するのと同じである。 .PP .in +4n diff --git a/manual/LDP_man-pages/draft/man5/host.conf.5 b/manual/LDP_man-pages/draft/man5/host.conf.5 new file mode 100644 index 00000000..2f405904 --- /dev/null +++ b/manual/LDP_man-pages/draft/man5/host.conf.5 @@ -0,0 +1,138 @@ +.\" Copyright (c) 1997 Martin Schulze (joey@infodrom.north.de) +.\" Much of the text is copied from the manpage of resolv+(8). +.\" +.\" %%%LICENSE_START(GPLv2+_DOC_FULL) +.\" This is free documentation; you can redistribute it and/or +.\" modify it under the terms of the GNU General Public License as +.\" published by the Free Software Foundation; either version 2 of +.\" the License, or (at your option) any later version. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.\" GNU General Public License for more details. +.\" +.\" You should have received a copy of the GNU General Public +.\" License along with this manual; if not, see +.\" . +.\" %%%LICENSE_END +.\" +.\" 2003-08-23 Martin Schulze Updated according to glibc 2.3.2 +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.\" +.\" Japanese Version Copyright (c) 2000-2003 Yuichi SATO +.\" all rights reserved. +.\" Translated Sun Sep 24 06:18:14 JST 2000 +.\" by Yuichi SATO +.\" Updated & Modified Sun Sep 7 17:51:03 JST 2003 +.\" by Yuichi SATO +.\" +.TH HOST.CONF 5 2019\-03\-06 Linux "Linux System Administration" +.SH 名前 +host.conf \- レゾルバ設定ファイル +.SH 説明 +ファイル \fI/etc/host.conf\fP には、レゾルバライブラリの詳細な設定情報が含まれている。 このファイルには、1 行毎に 1 +つの設定キーワードと それに続く適切な設定情報がなければならない。以下のキーワードが認識される。 +.TP +\fItrim\fP +このキーワードは、2 回以上リストすることができる。 毎回、このキーワードの後には、 ドットではじまる 1 +つ以上のドメイン名のリストを続けなければならない。 ドメイン名はコロン (\(aq:\(aq)、セミコロン (\(aq;\(aq)、コンマ +(\(aq,\(aq) で区切る。 このキーワードが設定されると、レゾルバライブラリは DNS でレゾルブされた +すべてのホスト名の後ろから与えられたドメイン名を自動的に取り去る。 このキーワードはローカルなホストとドメインで使用することを意図している。 +(関連した注意 : NIS または \fBhosts\fP(5) ファイルで集められたホスト名に \fItrim\fP は影響しない。 hosts +ファイルの各エントリーの最初のホスト名を、 完全なドメイン名付きのものにするかしないかは、 ホストごとのインストールポリシーにあわせて +適切に選択する必要がある。注意すること。) +.TP +\fImulti\fP +有効な値は \fIon\fP と \fIoff\fP である。 \fIon\fP に設定された場合、最初のエントリーのみを例外として、 レゾルバライブラリは +\fI/etc/hosts\fP ファイルに現れるホストに対して全ての有効なアドレスを返そうとする。 大きな hosts ファイルを持つサイトでは、 +この設定は非常な性能の低下を招くので、 デフォルトでは \fIoff\fP である。 +.TP +\fIreorder\fP +有効な値は \fIon\fP と \fIoff\fP である。 \fIon\fP に設定されると、 \fBgethostbyname (3)\fP +が実行されるとき、レゾルバライブラリは、ローカルな (つまり、同じサブネットにある) アドレスが最初にリストされるように ホストアドレスを並べ変える。 +すべてのルックアップ方式に対して並べ変えが行われる。 デフォルトの値は、 \fIoff\fP である。 +.SH 環境変数 +以下の環境変数を使って、ユーザーは \fI/etc/host.conf\fP で設定されている動作を上書きできる。 +.TP +\fBRESOLV_HOST_CONF\fP +この変数を設定すると、 \fI/etc/host.conf\fP の代りに読み込むファイルを設定できる。 +.TP +\fBRESOLV_MULTI\fP +\fImulti\fP コマンドを上書きする。 +.TP +\fBRESOLV_REORDER\fP +\fIreorder\fP コマンドを上書きする。 +.TP +\fBRESOLV_ADD_TRIM_DOMAINS\fP +コロン (\(aq:\(aq)、セミコロン (\(aq;\(aq)、コンマ (\(aq,\(aq) で区切った ドット (\(aq.\(aq) +で始まるドメイン名のリスト。 ホスト名から取り去るドメイン名のリストに追加する。 +.TP +\fBRESOLV_OVERRIDE_TRIM_DOMAINS\fP +コロン (\(aq:\(aq)、セミコロン (\(aq;\(aq)、コンマ (\(aq,\(aq) で区切った ドット (\(aq.\(aq) +で始まるドメイン名のリスト。 ホスト名から取り去るドメイン名のリストを上書きする。 \fItrim\fP コマンドを上書きする。 +.SH ファイル +.TP +\fI/etc/host.conf\fP +リゾルバ設定ファイル +.TP +\fI/etc/resolv.conf\fP +リゾルバ設定ファイル +.TP +\fI/etc/hosts\fP +ローカルの hosts データベース +.SH 注意 +元々の実装に比べて以下のような違いがある。 新しいコマンド \fIspoof\fP と新しい環境変数 \fBRESOLV_SPOOF_CHECK\fP は、引き数 +\fIoff\fP, \fInowarn\fP, \fIwarn\fP をとる。 コメントは行頭だけではなく、どこに書いてもよい。 +.SS Historical +The \fBnsswitch.conf\fP(5) file is the modern way of controlling the order of +host lookups. +.PP +In glibc 2.4 and earlier, the following keyword is recognized: +.TP +\fIorder\fP +このキーワードは、ホストのルックアップ方式を指定する。 このキーワードの後には、コンマで分けた 1 つ以上のルックアップ方式が続かなくてはならない。 +使用可能な方式は \fIbind\fP, \fIhosts\fP, \fInis\fP である。 +.TP +\fBRESOLV_SERV_ORDER\fP +\fIorder\fP コマンドを上書きする。 +.PP +.\" commit 7d68cdaa4f748e87ee921f587ee2d483db624b3d +Since glibc 2.0.7, and up through glibc 2.24, the following keywords and +environment variable have been recognized but never implemented: +.TP +\fInospoof\fP +有効な値は \fIon\fP と \fIoff\fP である。 \fIon\fP に設定された場合、レゾルバライブラリは \fBrlogin\fP と \fBrsh\fP +のセキュリティを向上させるためホスト名の偽装を防止しようとする。 これは、「ホストアドレスのルックアップを行った後、 +レゾルバライブラリはそのアドレスに対してホスト名のルックアップを行い、 もし 2 つのホスト名が一致しなかった場合は、クエリーは失敗する。」 +というように動作する。 デフォルトの値は \fIoff\fP である。 +.TP +\fIspoofalert\fP +有効な値は \fIon\fP と \fIoff\fP である。 このオプションが \fIon\fP に設定されていて、 \fInospoof\fP オプションも (on に) +設定されている場合、 レゾルバライブラリは syslog 機能を通じてエラーに関する警告のログをとる。 デフォルトの値は \fIoff\fP である。 +.TP +\fIspoof\fP +有効な値は \fIoff\fP, \fInowarn\fP, \fIwarn\fP である。 このオプションを \fIoff\fP に設定すると、偽装されたアドレスを許可して、 +syslog 機能を通じた警告を発しない。 このオプションを \fIwarn\fP +に設定すると、レゾルバライブラリはセキュリティを高めるためにホスト名の偽装を防止し、 syslog 機能を通じてエラーに関する警告のログをとる。 +このオプションを \fInowarn\fP に設定すると、レゾルバライブラリはセキュリティを高めるためにホスト名の偽装を防止するが、 syslog +機能を通じた警告は発しない。 このオプションを何も設定しない場合は、 \fInowarn\fP を設定したのと同じになる。 +.TP +\fBRESOLV_SPOOF_CHECK\fP +\fIspoof\fP コマンドを解析するのと同じ方式で、 \fInospoof\fP, \fIspoofalert\fP, \fIspoof\fP コマンドを上書きできる。 +有効な値は \fIoff\fP, \fInowarn\fP, \fIwarn\fP である。 +.SH 関連項目 +\fBgethostbyname\fP(3), \fBhosts\fP(5), \fBnsswitch.conf\fP(5), \fBresolv.conf\fP(5), +\fBhostname\fP(7), \fBnamed\fP(8) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は +\%https://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/manual/LDP_man-pages/draft/man5/hosts.5 b/manual/LDP_man-pages/draft/man5/hosts.5 index e6c1a859..d1816ad1 100644 --- a/manual/LDP_man-pages/draft/man5/hosts.5 +++ b/manual/LDP_man-pages/draft/man5/hosts.5 @@ -89,7 +89,7 @@ Information Control Center (NIC) によって 管理される公式ホストデ しかし、非公式なエイリアスや不明なホストを扱えるように、 最新に保つためのローカルな変更が頻繁に必要とされた。 NIC は既に hosts.txt を管理していないが、 これを書いている (2000 年頃の) 時点で調べてみると、 WWW 上に歴史的な hosts.txt が存在する。 92, 94, 95 年のものが見つかった。 -.SH EXAMPLES +.SH 例 .EX # The following lines are desirable for IPv4 capable hosts 127.0.0.1 localhost diff --git a/manual/LDP_man-pages/draft/man5/networks.5 b/manual/LDP_man-pages/draft/man5/networks.5 index 4b74c2ad..63481bad 100644 --- a/manual/LDP_man-pages/draft/man5/networks.5 +++ b/manual/LDP_man-pages/draft/man5/networks.5 @@ -64,9 +64,9 @@ DARPA ネットワークとその分かりやすい名前を記載したファ そのネットワークの別名 (省略可能)。 .PP .PP -This file is read by the \fBroute\fP(8) and \fBnetstat\fP(8) utilities. Only -Class A, B or C networks are supported, partitioned networks (i.e., -network/26 or network/28) are not supported by this file. +このファイルは、 \fBroute\fP(8) と \fBnetstat\fP(8) ユーティリティにより利用される。クラス A, B, C +のネットワークだけがサポートされており、 (network/26 や network/28 といった) +分割されたネットワークはこのファイルではサポートされていない。 .SH ファイル .TP \fI/etc/networks\fP diff --git a/manual/LDP_man-pages/draft/man5/nscd.conf.5 b/manual/LDP_man-pages/draft/man5/nscd.conf.5 index 2e62a4e9..0baeb09e 100644 --- a/manual/LDP_man-pages/draft/man5/nscd.conf.5 +++ b/manual/LDP_man-pages/draft/man5/nscd.conf.5 @@ -31,7 +31,7 @@ .\" .TH NSCD.CONF 5 2020\-12\-21 GNU "Linux Programmer's Manual" .SH 名前 -nscd.conf \- name service cache daemon configuration file +nscd.conf \- ネームサービスキャッシュデーモンの設定ファイル .SH 説明 \fBnscd\fP(8) は起動時にファイル \fI/etc/nscd.conf\fP を読み込む。 各行には「属性・値」または「属性・サービス・値」を指定する。 フィールドはスペース文字またはタブ文字で区切られる。 \(aq#\(aq (ナンバー記号) @@ -112,9 +112,8 @@ nscd.conf \- name service cache daemon configuration file .PP \fBcheck\-files\fP \fIservice\fP \fI\fP .RS -Enables or disables checking the file belonging to the specified \fIservice\fP -for changes. The files are \fI/etc/passwd\fP, \fI/etc/group\fP, \fI/etc/hosts\fP, -\fI/etc/services\fP, and \fI/etc/netgroup\fP. The default is yes. +指定した \fIservice\fP に関連するファイルの変更のチェックを有効または無効にする。 ファイルは \fI/etc/passwd\fP, +\fI/etc/group\fP, \fI/etc/hosts\fP である。デフォルトは有効。 .RE .PP \fBpersistent\fP \fIservice\fP \fI\fP diff --git a/manual/LDP_man-pages/draft/man5/nss.5 b/manual/LDP_man-pages/draft/man5/nss.5 index 5955ce9f..b13e48c0 100644 --- a/manual/LDP_man-pages/draft/man5/nss.5 +++ b/manual/LDP_man-pages/draft/man5/nss.5 @@ -59,7 +59,7 @@ TRUE でない場合、 \fBgetpwent\fP(3) や \fBgetgrent\fP(3) の各々の呼 次のエントリーを取得するためにサーバーとのネットワーク通信が発生する。 .SH ファイル \fI/etc/default/nss\fP -.SH EXAMPLES +.SH 例 デフォルト設定は、 以下の設定ファイルと同じである。 .PP .in +4n diff --git a/manual/LDP_man-pages/draft/man5/nsswitch.conf.5 b/manual/LDP_man-pages/draft/man5/nsswitch.conf.5 new file mode 100644 index 00000000..37006f16 --- /dev/null +++ b/manual/LDP_man-pages/draft/man5/nsswitch.conf.5 @@ -0,0 +1,348 @@ +.\" Copyright (c) 1998, 1999 Thorsten Kukuk (kukuk@vt.uni-paderborn.de) +.\" Copyright (c) 2011, Mark R. Bannister +.\" +.\" %%%LICENSE_START(GPLv2+_DOC_FULL) +.\" This is free documentation; you can redistribute it and/or +.\" modify it under the terms of the GNU General Public License as +.\" published by the Free Software Foundation; either version 2 of +.\" the License, or (at your option) any later version. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.\" GNU General Public License for more details. +.\" +.\" You should have received a copy of the GNU General Public +.\" License along with this manual; if not, see +.\" . +.\" %%%LICENSE_END +.\" +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.\" +.\" Japanese Version Copyright (c) 1998 NAKANO Takeo all rights reserved. +.\" Translated Wed Apr 29 1998 by NAKANO Takeo +.\" Updated & Modified Sat Aug 21 1999 +.\" by NAKANO Takeo +.\" Updated Fri Oct 12 JST 2001 by Akihiro MOTOKI +.\" Updated 2012-05-06, Akihiro MOTOKI +.\" Updated 2013-05-01, Akihiro MOTOKI +.\" Updated 2013-05-06, Akihiro MOTOKI +.\" +.TH NSSWITCH.CONF 5 2017\-05\-03 Linux "Linux Programmer's Manual" +.SH 名前 +nsswitch.conf \- ネームサービススイッチの設定ファイル +.SH 説明 +The Name Service Switch (NSS) configuration file, \fI/etc/nsswitch.conf\fP, is +used by the GNU C Library and certain other applications to determine the +sources from which to obtain name\-service information in a range of +categories, and in what order. Each category of information is identified +by a database name. +.PP +設定ファイルは通常の ASCII テキストで、列はスペースかタブ文字で +区切られる。最初の列はデータベース名を示す。 +残りの列は、情報を問い合わせる情報源の順序と、 +検索結果に対して実行するアクションを規定する。 +.PP +GNU C ライブラリでは以下のデータベースを扱うことができる。 +.TP 12 +\fBaliases\fP +メールのエイリアス。 \fBgetaliasent\fP(3) や関連する関数が使用する。 +.TP +\fBethers\fP +イーサーネット番号。 +.TP +\fBgroup\fP +ユーザーのグループ。 \fBgetgrent\fP(3) や関連する関数が使用する。 +.TP +\fBhosts\fP +ホスト名とホスト番号。 \fBgethostbyname\fP(3) や関連する関数が使用する。 +.TP +\fBinitgroups\fP +補助グループアクセスリスト。 \fBgetgrouplist\fP(3) 関数が使用する。 +.TP +\fBnetgroup\fP +ネットワークワイドに用いられるホストやユーザーのリスト。アクセス制限に利用 +される。 glibc 2.1 より前の C ライブラリは、 NIS による netgroup のみを +サポートしていた。 +.TP +\fBnetworks\fP +ネットワーク名と番号。 \fBgetnetent\fP(3) と関連する関数が使用する。 +.TP +\fBpasswd\fP +ユーザーパスワード。 \fBgetpwent\fP(3) や関連する関数が使用する。 +.TP +\fBprotocols\fP +ネットワークプロトコル。 \fBgetprotoent\fP(3) や関連する関数が使用する。 +.TP +\fBpublickey\fP +NIS+ と NFS によって用いられる secure_rpc の公開鍵と秘密鍵。 +.TP +\fBrpc\fP +リモート手続き呼び出し (remote procedure call) の名前と番号。 +\fBgetrpcbyname\fP(3) と関連する関数が使用する。 +.TP +\fBservices\fP +ネットワークサービス。 \fBgetservent\fP(3) や関連する関数が使用する。 +.TP +\fBshadow\fP +シャドウユーザーパスワード。 \fBgetspnam\fP(3) や関連する関数が使用する。 +.PP +The GNU C Library ignores databases with unknown names. Some applications +use this to implement special handling for their own databases. For +example, \fBsudo\fP(8) consults the \fBsudoers\fP database. +.PP +以下は \fI/etc/nsswitch.conf\fP ファイルの例である。 +.PP +.in +4n +.EX +passwd: compat +group: compat +shadow: compat + +hosts: dns [!UNAVAIL=return] files +networks: nis [NOTFOUND=return] files +ethers: nis [NOTFOUND=return] files +protocols: nis [NOTFOUND=return] files +rpc: nis [NOTFOUND=return] files +services: nis [NOTFOUND=return] files +.EE +.in +.PP +最初の列はデータベース名である。 +残りの列で以下を指定する。 +.IP * 3 +1 個以上のサービス指定 (例: "files", "db", "nis")。この行に記載された +サービスの順序で、結果が得られるまで、指定されたサービスに対する +問い合わせが順番に行われる。 +.IP * +特定の結果が直前のサービスで得られた場合に実行されるアクション +(例: "[NOTFOUND=return]")。アクションは省略可能である。 +.PP +利用しているシステムでどのサービス指定が利用できるかは、共有ライブラリ +があるかどうかに依存しており、そのためサービス指定は拡張できるように +なっている。\fI/lib/libnss_SERVICE.so.\fP\fBX\fP という名前のライブラリが +\fISERVICE\fP という名前のサービスを提供する。標準のインストールを行った +場合、"files", "db", "nis", "nisplus" が利用できる。 +データベース \fBhosts\fP の場合には、追加で "dns" も指定できる。 +データベース \fBpasswd\fP, \fBgroup\fP, \fBshadow\fP の場合には、追加で +"compat" (下記の \fB互換モード\fP を参照)。バージョン番号 \fBX\fP は、 +glibc 2.0 の場合は 1、glibc 2.1 の場合は 2 で、それ以降も同様である。 +追加のライブラリがインストールされているシステムでは、"hesiod", +"ldap", "winbind", "wins" などの追加のサービスが利用できる。 +.PP +サービス指定の次にアクションを指定することもできる。アクションを +使うと、直前のデータ源から結果が得られた後の動作を変更できる。 +アクション指定は、一般的には以下の形式となる。 +.PP +.RS 4 +[\fISTATUS\fP=\fIACTION\fP] +.br +[!\fISTATUS\fP=\fIACTION\fP] +.RE +.PP +STATUS と ACTION はそれぞれ以下の値を取る。 +.PP +.RS 4 +\fISTATUS\fP => \fBsuccess\fP | \fBnotfound\fP | \fBunavail\fP | \fBtryagain\fP +.br +\fIACTION\fP => \fBreturn\fP | \fBcontinue\fP | \fBmerge\fP +.RE +.PP +! はテスト結果を反転させる。 +つまり、指定された以外の全ての結果にマッチする。 +キーワードの大文字、小文字は無視される。 +.PP +\fISTATUS\fP は、直前のサービス指定で呼び出しされた検索処理の結果に +対して照合が行われる。 \fISTATUS\fP には以下のいずれかを指定できる。 +.RS 4 +.TP 12 +\fBsuccess\fP +エラーは発生せず、要求されたエントリーが返された。 +この場合のデフォルトのアクションは "return" である。 +.TP +\fBnotfound\fP +検索は成功したが、要求されたエントリーが見つからなかった。 +この場合のデフォルトのアクションは "continue" である。 +.TP +\fBunavail\fP +サービスが永続的に利用できない。 +必要なファイルを読み込むことができない、 +ネットワークサービスの場合には、サーバが利用できないとか、 +サーバが問い合わせを許可していない、などが考えられる。 +この場合のデフォルトのアクションは "continue" である。 +.TP +\fBtryagain\fP +サービスが一時的に利用できない。 +ファイルがロックされている、サーバがこれ以上接続を受け付けることができない、 +などが考えられる。デフォル トのアクションは "continue" である。 +.RE +.PP +\fIACTION\fP には以下のいずれかを指定できる。 +.RS 4 +.TP 12 +\fBreturn\fP +結果をすぐに返す。 これ以上検索処理は呼び出されない。 ただし、互換性のため、 選択されたアクションが \fBgroup\fP データベースに対するもので、 +ステータスが \fBnotfound\fP であった場合で、 設定ファイルに \fBinitgroups\fP +の行が含まれていない場合には、次の検索処理は常に呼び出される (検索結果への影響はない)。 +.TP +\fBcontinue\fP +次の検索処理を呼び出す。 +.TP +\fBmerge\fP +\fI[SUCCESS=merge]\fP is used between two database entries. When a group is +located in the first of the two group entries, processing will continue on +to the next one. If the group is also found in the next entry (and the +group name and GID are an exact match), the member list of the second entry +will be added to the group object to be returned. Available since glibc +2.24. Note that merging will not be done for \fBgetgrent\fP(3) nor will +duplicate members be pruned when they occur in both entries being merged. +.RE +.SS "互換モード (compat)" +The NSS "compat" service is similar to "files" except that it additionally +permits special entries in corresponding files for granting users or members +of netgroups access to the system. The following entries are valid in this +mode: +.RS 4 +.PP +For \fBpasswd\fP and \fBshadow\fP databases: +.RS 4 +.TP 12 +\fB+\fP\fIuser\fP +NIS パスワード/shadow マップの指定された \fIuser\fP を含める。 +.TP +\fB+@\fP\fInetgroup\fP +指定された \fInetgroup\fP の全ユーザーを含める。 +.TP +\fB\-\fP\fIuser\fP +NIS パスワード/shadow マップの指定された \fIuser\fP を除外する。 +.TP +\fB\-@\fP\fInetgroup\fP +指定された \fInetgroup\fP の全ユーザーを除外する。 +.TP +\fB+\fP +Include every user, except previously excluded ones, from the NIS +passwd/shadow map. +.RE +.PP +For \fBgroup\fP database: +.RS 4 +.TP 12 +\fB+\fP\fIgroup\fP +NIS グループマップの指定された \fIgroup\fP を含める。 +.TP +\fB\-\fP\fIgroup\fP +NIS グループマップの指定された \fIgroup\fP を除外する。 +.TP +\fB+\fP +NIS グループマップのグループのうち、それまでに除外されていない全てのグループを含める。 +.RE +.RE +.PP +By default, the source is "nis", but this may be overridden by specifying +any NSS service except "compat" itself as the source for the +pseudo\-databases \fBpasswd_compat\fP, \fBgroup_compat\fP, and \fBshadow_compat\fP. +.SH ファイル +\fISERVICE\fP という名前のサービスは \fIlibnss_SERVICE.so.\fP\fBX\fP という +名前の共有オブジェクトライブラリで実装されている。 +これは \fI/lib\fP に置かれる。 +.RS 4 +.TP 25 +.PD 0 +\fI/etc/nsswitch.conf\fP +NSS の設定ファイル。 +.TP +\fI/lib/libnss_compat.so.\fP\fBX\fP +"compat" ソースを実装したもの。 +.TP +\fI/lib/libnss_db.so.\fP\fBX\fP +"db" ソースを実装したもの。 +.TP +\fI/lib/libnss_dns.so.\fP\fBX\fP +"dns" ソースを実装したもの。 +.TP +\fI/lib/libnss_files.so.\fP\fBX\fP +"files" ソースを実装したもの。 +.TP +\fI/lib/libnss_hesiod.so.\fP\fBX\fP +"hesoid" ソースを実装したもの。 +.TP +\fI/lib/libnss_nis.so.\fP\fBX\fP +"nis" ソースを実装したもの。 +.TP +\fI/lib/libnss_nisplus.so.\fP\fBX\fP +"nisplus" ソースを実装したもの。 +.PD +.RE +.PP +The following files are read when "files" source is specified for respective +databases: +.RS 4 +.TP 12 +.PD 0 +\fBaliases\fP +\fI/etc/aliases\fP +.TP +\fBethers\fP +\fI/etc/ethers\fP +.TP +\fBgroup\fP +\fI/etc/group\fP +.TP +\fBhosts\fP +\fI/etc/hosts\fP +.TP +\fBinitgroups\fP +\fI/etc/group\fP +.TP +\fBnetgroup\fP +\fI/etc/netgroup\fP +.TP +\fBnetworks\fP +\fI/etc/networks\fP +.TP +\fBpasswd\fP +\fI/etc/passwd\fP +.TP +\fBprotocols\fP +\fI/etc/protocols\fP +.TP +\fBpublickey\fP +\fI/etc/publickey\fP +.TP +\fBrpc\fP +\fI/etc/rpc\fP +.TP +\fBservices\fP +\fI/etc/services\fP +.TP +\fBshadow\fP +\fI/etc/shadow\fP +.PD +.RE +.SH 注意 +\fInsswitch.conf\fP を利用するプロセスは、ファイルは一度しか読み込まない。 +その後で nsswitch.conf が書き換えられても、そのプロセスは古い設定のままで +動作を継続する。 +.PP +伝統的には、サービス情報の情報源は一つだけであり、 +その設定ファイルの形式も一つであった (例えば \fI/etc/passwd\fP)。 +一方で、 Network Information Service (NIS) や Domain Name Service +(DNS) などの他の名前サービスが一般的になるに連れて、C ライブラリに埋め +込まれた固定順序ではなく、検索順序を柔軟に指定する方法が必要になった。 +ネームサービススイッチ機構は、この問題に対するよりきれいな解決方法と +なっている。ネームサービススイッチ機構は、 Sun Microsystems が +Solaris 2 の C ライブラリで使った機構が基になっている。 +.SH 関連項目 +\fBgetent\fP(1), \fBnss\fP(5) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は +\%https://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/manual/LDP_man-pages/draft/man5/resolv.conf.5 b/manual/LDP_man-pages/draft/man5/resolv.conf.5 new file mode 100644 index 00000000..22523f32 --- /dev/null +++ b/manual/LDP_man-pages/draft/man5/resolv.conf.5 @@ -0,0 +1,259 @@ +.\" Copyright (c) 1986 The Regents of the University of California. +.\" All rights reserved. +.\" +.\" %%%LICENSE_START(PERMISSIVE_MISC) +.\" Redistribution and use in source and binary forms are permitted +.\" provided that the above copyright notice and this paragraph are +.\" duplicated in all such forms and that any documentation, +.\" advertising materials, and other materials related to such +.\" distribution and use acknowledge that the software was developed +.\" by the University of California, Berkeley. The name of the +.\" University may not be used to endorse or promote products derived +.\" from this software without specific prior written permission. +.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +.\" %%%LICENSE_END +.\" +.\" @(#)resolver.5 5.9 (Berkeley) 12/14/89 +.\" $Id: resolver.5,v 8.6 1999/05/21 00:01:02 vixie Exp $ +.\" +.\" Added ndots remark by Bernhard R. Link - debian bug #182886 +.\" +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.\" +.\" Japanese Version Copyright (c) 2000, 2005 Yuichi SATO +.\" all rights reserved. +.\" Translated 2000-09-15, Yuichi SATO +.\" Updated & Modified 2005-01-22, Yuichi SATO +.\" Updated 2010-04-18, Akihiro MOTOKI , LDP v3.24 +.\" Updated 2012-04-30, Akihiro MOTOKI +.\" Updated 2012-05-06, Akihiro MOTOKI +.\" Updated 2012-05-29, Akihiro MOTOKI +.\" Updated 2013-05-01, Akihiro MOTOKI +.\" Updated 2013-05-06, Akihiro MOTOKI +.\" Updated 2013-08-16, Akihiro MOTOKI +.\" +.TH RESOLV.CONF 5 2020\-08\-13 "" "Linux Programmer's Manual" +.UC 4 +.SH 名前 +resolv.conf \- レゾルバ設定ファイル +.SH 書式 +\fB/etc/resolv.conf\fP +.SH 説明 +The \fIresolver\fP is a set of routines in the C library that provide access to +the Internet Domain Name System (DNS). The resolver configuration file +contains information that is read by the resolver routines the first time +they are invoked by a process. The file is designed to be human readable +and contains a list of keywords with values that provide various types of +resolver information. The configuration file is considered a trusted source +of DNS information; see the \fBtrust\-ad\fP option below for details. +.PP +If this file does not exist, only the name server on the local machine will +be queried, and the search list contains the local domain name determined +from the hostname. +.PP +この状態を変更するための設定オプションには、以下のようなものがある。 +.TP +\fBnameserver\fP ネームサーバの IP アドレス +レゾルバが問い合わせをするネームサーバのインターネットアドレス。 アドレスには IPv4 アドレスか IPv6 アドレスを指定する。 IPv4 +アドレスはドット表記で、 IPv6 アドレスは RFC 2373 で定められたコロン表記 (おそらくドット表記も可) で指定する。 このキーワード 1 +つごとに 1 台づつ、 \fBMAXNS\fP 台 (現状では 3 台、\fI\fP を参照) +までのネームサーバをリストできる。 複数のサーバが指定された場合、レゾルバライブラリは リストされた順に問い合わせを行う。 \fBnameserver\fP +エントリーがない場合、 デフォルトではローカルマシン上のネームサーバが使われる。 (ここで使われるアルゴリズムは以下のようなものである。 +はじめにネームサーバに問い合わせを試みる。 この問い合わせがタイムアウトになった場合、 次のネームサーバに問い合わせを試みる。 +これをネームサーバがなくなるまで続ける。 それでも応答がない場合は、リトライ最大回数に達するまで 全てのネームサーバに問い合わせを繰り返す。) +.TP +\fBsearch\fP ホスト名ルックアップのための検索リスト +By default, the search list contains one entry, the local domain name. It +is determined from the local hostname returned by \fBgethostname\fP(2); the +local domain name is taken to be everything after the first \(aq.\(aq. +Finally, if the hostname does not contain a \(aq.\(aq, the root domain is +assumed as the local domain name. +.IP +.\" When having a resolv.conv with a line +.\" search subdomain.domain.tld domain.tld +.\" and doing a hostlookup, for example by +.\" ping host.anothersubdomain +.\" it sends dns-requests for +.\" host.anothersubdomain. +.\" host.anothersubdomain.subdomain.domain.tld. +.\" host.anothersubdomain.domain.tld. +.\" thus not only causing unnecessary traffic for the root-dns-servers +.\" but broadcasting information to the outside and making man-in-the-middle +.\" attacks possible. +これを変更するには、\fIsearch\fP キーワードの後に 希望するドメイン検索パスをスペースまたはタブで区切ってリストすればよい。 ドットの数が +\fIndots\fP (デフォルトでは 1) より少ないレゾルバの問い合わせは、 一致するものが見つかるまで検索パスの各要素を順に使って試す。 +複数のサブドメインを持つ環境では、 第三者による攻撃 (man\-in\-the\-middle attack) と ルート DNS +サーバへの不必要なトラフィックを避けるために、 以下の \fBoptions ndots:\fP\fIn\fP を読んでほしい。 +このプロセスは遅く、リストされたドメインがローカルのものでない場合、 多大なネットワークトラフィックを発生させることに注意すること。 +さらに、これらのドメインのいずれかひとつにでも適切なサーバがない場合、 問い合わせがタイムアウトになる点にも注意すること。 +.IP +If there are multiple \fBsearch\fP directives, only the search list from the +last instance is used. +.IP +.\" glibc commit 3f853f22c87f0b671c0366eb290919719fa56c0e +In glibc 2.25 and earlier, the search list is limited to six domains with a +total of 256 characters. Since glibc 2.26, the search list is unlimited. +.IP +The \fBdomain\fP directive is an obsolete name for the \fBsearch\fP directive that +handles one search list entry only. +.TP +\fBsortlist\fP +このオプションを使うと、 \fBgethostbyname\fP(3) で返されるアドレスをソートさせることができる。 sortlist は IP +アドレスとネットマスクのペアで指定される。 ネットマスクは省略可能であり、 デフォルトではネットに対するデフォルトのネットマスクである。 IP +アドレスとオプションのネットマスクのペアはスラッシュで区切る。 最大 10 組のペアを指定できる。 以下に例を示す。 +.IP +.in +4n +sortlist 130.155.160.0/255.255.240.0 130.155.0.0 +.in +.TP +\fBoptions\fP +options により、レゾルバの内部変数を変更することができる。 書式は以下の通りである。 +.RS +.IP +\fBoptions\fP \fIoption\fP \fI...\fP +.PP +ここで \fIoption\fP は次のうちのいずれかである。 +.TP +\fBdebug\fP +.\" Since glibc 2.2? +\fBRES_DEBUG\fP を \fI_res.options\fP にセットする (glibc +がデバッグを有効にしてコンパイルされている場合にのみ有効である; \fBresolver\fP(3) を参照)。 +.TP +\fBndots:\fP\fIn\fP +.\" Since glibc 2.2 +「\fI最初の完全な名前での問い合わせ\fPが実行される前に、 \fBres_query\fP(3) (\fBresolver\fP(3) を参照) +に与えられる名前に含まれているべきドットの数の閾値」を設定する。 \fIn\fP のデフォルトは 1 である。 +これは、名前にドットがある場合、\fIsearch list\fP の要素が付加される前に、 +その名前が完全な名前として最初に試されるということを意味している。 このオプションの値の上限は 15 であり、黙ってこの値まで切り詰められる。 +.TP +\fBtimeout:\fP\fIn\fP +.\" Since glibc 2.2 +Sets the amount of time the resolver will wait for a response from a remote +name server before retrying the query via a different name server. This may +\fBnot\fP be the total time taken by any resolver API call and there is no +guarantee that a single resolver API call maps to a single timeout. +Measured in seconds, the default is \fBRES_TIMEOUT\fP (currently 5, see +\fI\fP). The value for this option is silently capped to 30. +.TP +\fBattempts:\fP\fIn\fP +「レゾルバが諦めて呼び出し元のアプリケーションにエラーを返すまでに、 ネームサーバに問い合わせを行う回数」を設定する。 デフォルトは +\fBRES_DFLRETRY\fP 回である (現状では 2 回、\fI\fP を参照)。 このオプションの値の上限は 5 +であり、黙ってこの値まで切り詰められる。 +.TP +\fBrotate\fP +.\" Since glibc 2.2 +\fI_res.options\fP に RES_ROTATE を設定する。リストされているネームサーバから選ぶときに、ラウンドロビン +(round\-robin) +選択を行わせる。リストされている全てのサーバで問い合わせの負荷を分散する効果があり、最初にリストされたサーバに全てのクライアントが毎回最初に問い合わせを行うわけではなくなる。 +.TP +\fBno\-check\-names\fP +.\" since glibc 2.2 +\fI_res.options\fP に \fBRES_NOCHECKNAME\fP を設定する。 入ってくるホスト名とメールアドレスに、 アンダースコア +(_)・ASCII 以外の文字・制御文字といった 不正な文字が含まれていないかを調べる 最近の BIND のチェックを無効にする。 +.TP +\fBinet6\fP +.\" Since glibc 2.2 +.\" b76e065991ec01299225d9da90a627ebe6c1ac97 +Sets \fBRES_USE_INET6\fP in \fI_res.options\fP. This has the effect of trying an +AAAA query before an A query inside the \fBgethostbyname\fP(3) function, and +of mapping IPv4 responses in IPv6 "tunneled form" if no AAAA records are +found but an A record set exists. Since glibc 2.25, this option is +deprecated; applications should use \fBgetaddrinfo\fP(3), rather than +\fBgethostbyname\fP(3). +.TP +\fBip6\-bytestring\fP (glibc 2.3.4 から 2.24 まで) +Sets \fBRES_USEBSTRING\fP in \fI_res.options\fP. This causes reverse IPv6 lookups +to be made using the bit\-label format described in RFC\ 2673; if this option +is not set (which is the default), then nibble format is used. This option +was removed in glibc 2.25, since it relied on a backward\-incompatible DNS +extension that was never deployed on the Internet. +.TP +\fBip6\-dotint\fP/\fBno\-ip6\-dotint\fP (glibc 2.3.4 から 2.24 まで) +Clear/set \fBRES_NOIP6DOTINT\fP in \fI_res.options\fP. When this option is clear +(\fBip6\-dotint\fP), reverse IPv6 lookups are made in the (deprecated) +\fIip6.int\fP zone; when this option is set (\fBno\-ip6\-dotint\fP), reverse IPv6 +lookups are made in the \fIip6.arpa\fP zone by default. These options are +available in glibc versions up to 2.24, where \fBno\-ip6\-dotint\fP is the +default. Since \fBip6\-dotint\fP support long ago ceased to be available on the +Internet, these options were removed in glibc 2.25. +.TP +\fBedns0\fP (glibc 2.6 以降) +\fI_res.options\fP に \fBRES_USE_EDNSO\fP をセットする。これにより、RFC\ 2671 で規定されている DNS +拡張のサポートが有効になる。 +.TP +\fBsingle\-request\fP (glibc 2.10 以降) +\fI_res.options\fP に \fBRES_SNGLKUP\fP をセットする。 +glibc バージョン 2.9 以降では、 glibc はデフォルトでは +IPv4 と IPv6 の検索を並行して実行する。 +アプライアンス DNS サーバの中には、このような問い合わせを +適切に処理できず、検索要求がタイムアウトになってしまう。 +このオプションをセットすると、このデフォルトの動作が無効になり、 +glibc は IPv6 と IPv4 の検索を順番に実行するようになる +(名前解決処理が若干遅くなるというデメリットがある)。 +.TP +\fBsingle\-request\-reopen\fP (glibc 2.9 以降) +\fI_res.options\fP に \fBRES_SNGLKUPREOP\fP をセットする。リゾルバは同じソケットを使って A レコードと AAAA +レコードの検索要求を行う。 いくつかのハードウェアは実装が間違っており、応答を一つしか返さない。 この状況になると、クライアントシステムは 2 +番目の応答を待ち続けてしまう。 このオプションを有効にすると、この動作が変更され、 同じポートからの 2 つの検索要求が正しく処理されなかった場合、 2 +番目の検索要求を送信する前にソケットをクローズし 新しいソケットをオープンするようになる。 +.TP +\fBno\-tld\-query\fP (glibc 2.14 以降) +RES_NOTLDQUERY を \fI_res.options\fP にセットする。 このオプションを設定すると、 \fBres_nsearch\fP() +が完全なドメイン名ではない名前のトップレベルドメイン (TLD) としての検索を行わなくなる。 これにより、localhost +に検索リストの要素をつけるのではなく、\*(lqlocalhost\*(rq を TLD として設定しているようなサイトでは問題が起こる可能性がある。 +RES_DEFNAMES も RES_DNSRCH もセットされていない場合には、このオプションは効果はない。 +.TP +\fBuse\-vc\fP (glibc 2.14 以降) +.\" aef16cc8a4c670036d45590877d411a97f01e0cd +Sets \fBRES_USEVC\fP in \fI_res.options\fP. This option forces the use of TCP for +DNS resolutions. +.TP +\fBno\-reload\fP (glibc 2.26 以降) +Sets \fBRES_NORELOAD\fP in \fI_res.options\fP. This option disables automatic +reloading of a changed configuration file. +.TP +\fBtrust\-ad\fP (glibc 2.31 以降) +.\" 446997ff1433d33452b81dfa9e626b8dccf101a4 +Sets \fBRES_TRUSTAD\fP in \fI_res.options\fP. This option controls the AD bit +behavior of the stub resolver. If a validating resolver sets the AD bit in +a response, it indicates that the data in the response was verified +according to the DNSSEC protocol. In order to rely on the AD bit, the local +system has to trust both the DNSSEC\-validating resolver and the network path +to it, which is why an explicit opt\-in is required. If the \fBtrust\-ad\fP +option is active, the stub resolver sets the AD bit in outgoing DNS queries +(to enable AD bit support), and preserves the AD bit in responses. Without +this option, the AD bit is not set in queries, and it is always removed from +responses before they are returned to the application. This means that +applications can trust the AD bit in responses if the \fBtrust\-ad\fP option has +been set correctly. +.IP +In glibc version 2.30 and earlier, the AD is not set automatically in +queries, and is passed through unchanged to applications in responses. +.RE +.PP +システムの \fIresolv.conf\fP ファイルにある \fIsearch\fP キーワードは、 スペースで区切った検索ドメインのリストを 環境変数 +\fBLOCALDOMAIN\fP に設定することにより、各プロセス毎に上書きすることができる。 +.PP +システムの \fIresolv.conf\fP ファイルにある \fIoptions\fP キーワードは、 上の \fBoptions\fP セクションで説明したように、 +スペースで区切ったレゾルバオプションのリストを 環境変数 \fBRES_OPTIONS\fP に設定することにより、各プロセス毎に修正することができる。 +.PP +キーワードと値は同じ行に書かなければならない。 また、(\fBnameserver\fP のような) キーワードが行の先頭になければならない。 +値はキーワードの後にスペースで区切って続ける。 +.PP +セミコロン (;) かハッシュ文字 (#) で始まる行はコメントとして扱われる。 +.SH ファイル +\fI/etc/resolv.conf\fP, \fI\fP +.SH 関連項目 +\fBgethostbyname\fP(3), \fBresolver\fP(3), \fBhost.conf\fP(5), \fBhosts\fP(5), +\fBnsswitch.conf\fP(5), \fBhostname\fP(7), \fBnamed\fP(8) +.PP +BIND のネームサーバオペレーションガイド +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は +\%https://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/manual/LDP_man-pages/draft/man7/ddp.7 b/manual/LDP_man-pages/draft/man7/ddp.7 index 95aff090..0d65bb22 100644 --- a/manual/LDP_man-pages/draft/man7/ddp.7 +++ b/manual/LDP_man-pages/draft/man7/ddp.7 @@ -155,9 +155,8 @@ AARP クエリーの最大再送信回数。この回数を越えると、 そ .SH バージョン AppleTalk は Linux 2.0 以降でサポートされている。 \fI/proc\fP インターフェースは Linux 2.2 以降に存在する。 .SH 注意 -Be very careful with the \fBSO_BROADCAST\fP option; it is not privileged in -Linux. It is easy to overload the network with careless sending to -broadcast addresses. +\fBSO_BROADCAST\fP オプションを用いる時には慎重の上にも慎重になってほしい。 Linux ではこれに特権を必要としない。 +不注意にブロードキャストアドレスに送信を行うと、 ネットワークの状態が簡単に変更されてしまう。 .SS 移植性 基本的な Appletalk ソケットインターフェースは BSD 由来のシステムにおける \fBnetatalk\fP と互換性がある。多くの BSD システムでは、 ブロードキャストフレームを送信しようとしたときの \fBSO_BROADCAST\fP @@ -168,8 +167,7 @@ raw ソケットモードは Linux 独特のもので、もう一方の実装で .SH バグ エラーの値がまったく首尾一貫していない。 .PP -The ioctls used to configure routing tables, devices, AARP tables, and other -devices are not yet described. +ルーティングテーブル、 デバイス、 AARP テーブル、 その他のデバイスを設定するために用いられる ioctl がまだ記述されていない。 .SH 関連項目 \fBrecvmsg\fP(2), \fBsendmsg\fP(2), \fBcapabilities\fP(7), \fBsocket\fP(7) .SH この文書について diff --git a/manual/LDP_man-pages/draft/man7/hostname.7 b/manual/LDP_man-pages/draft/man7/hostname.7 new file mode 100644 index 00000000..38f00763 --- /dev/null +++ b/manual/LDP_man-pages/draft/man7/hostname.7 @@ -0,0 +1,110 @@ +.\" Copyright (c) 1987, 1990, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" %%%LICENSE_START(BSD_4_CLAUSE_UCB) +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" %%%LICENSE_END +.\" +.\" @(#)hostname.7 8.2 (Berkeley) 12/30/93 +.\" $FreeBSD: src/share/man/man7/hostname.7,v 1.7 2004/07/03 18:29:23 ru Exp $ +.\" +.\" 2008-06-11, mtk, Taken from FreeBSD 6.2 and modified for Linux. +.\" +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.\" +.\" Japanese Version Copyright (c) 2012 Akihiro MOTOKI +.\" all rights reserved. +.\" Translated 2012-05-08, Akihiro MOTOKI +.\" +.TH HOSTNAME 7 2019\-05\-09 Linux "Linux Programmer's Manual" +.SH 名前 +hostname \- ホスト名の名前解決の説明 +.SH 説明 +ホスト名は、階層構造でドット区切りのサブドメインである。例えば、 "com" ドメインの "example" サブドメインのマシン "monet" は、 +"monet.example.com" と表現される。 +.PP +Each element of the hostname must be from 1 to 63 characters long and the +entire hostname, including the dots, can be at most 253 characters long. +Valid characters for hostnames are \fBASCII\fP(7) letters from \fIa\fP to \fIz\fP, +the digits from \fI0\fP to \fI9\fP, and the hyphen (\-). A hostname may not start +with a hyphen. +.PP +ホスト名は、ネットワーククライアントやサーバのプログラムでは一般的に使用され、使用する際には名前からアドレスに変換しなければならない +(一般的にはアドレスへの変換処理は \fBgetaddrinfo\fP(3) か (廃止予定の) +\fBgethostbyname\fP(3) で行われる)。 +.PP +Hostnames are resolved by the NSS framework in glibc according to the +\fBhosts\fP configuration in \fBnsswitch.conf\fP. The DNS\-based name resolver (in +the \fBdns\fP NSS service module) resolves them in the following fashion. +.PP +ホスト名がドットを含まない単一要素で構成されていて、環境変数 +\fBHOSTALIASES\fP にファイル名が設定されている場合、入力されたホスト名に +マッチする文字列を検索するのに指定されたファイルが使用される。 +そのファイルの各行は、ホワイトスペースで区切られた文字列 2 つで +構成され、各行の最初の文字列がホスト名のエイリアス (別名) で、 +二番目の文字列がそのエイリアスに対応する完全なホスト名である。 +解決するホスト名と一致するホスト名のエイリアス (ファイルの各行の最初の +フィールド) が見つかれば、完全なホスト名に置き換えられ、 +それ以上の変換処理は行わずに、そのホスト名で検索処理が行われる +(ホスト名とエイリアスの照合では大文字、小文字の違いは無視される)。 +.PP +入力されたホスト名の末尾がドットの場合、 +末尾のドットは削除され、それ以上の処理は行われず、 +(末尾のドットを削除した) 残りの名前で検索が行われる。 +.PP +If the input name does not end with a trailing dot, it is looked up by +searching through a list of domains until a match is found. The default +search list includes first the local domain, then its parent domains with at +least 2 name components (longest first). For example, in the domain +cs.example.com, the name lithium.cchem will be checked first as +lithium.cchem.cs.example and then as lithium.cchem.example.com. +lithium.cchem.com will not be tried, as there is only one component +remaining from the local domain. The search path can be changed from the +default by a system\-wide configuration file (see \fBresolver\fP(5)). +.SH 関連項目 +\fBgetaddrinfo\fP(3), \fBgethostbyname\fP(3), \fBnsswitch.conf\fP(5), \fBresolver\fP(5), +\fBmailaddr\fP(7), \fBnamed\fP(8) +.PP +.UR http://www.ietf.org\:/rfc\:/rfc1123.txt +IETF RFC\ 1123 +.UE +.PP +.\" .SH HISTORY +.\" Hostname appeared in +.\" 4.2BSD. +.UR http://www.ietf.org\:/rfc\:/rfc1178.txt +IETF RFC\ 1178 +.UE +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は +\%https://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/manual/LDP_man-pages/draft/man7/ip.7 b/manual/LDP_man-pages/draft/man7/ip.7 new file mode 100644 index 00000000..8b7bc224 --- /dev/null +++ b/manual/LDP_man-pages/draft/man7/ip.7 @@ -0,0 +1,881 @@ +.\" This man page is Copyright (C) 1999 Andi Kleen . +.\" +.\" %%%LICENSE_START(VERBATIM_ONE_PARA) +.\" Permission is granted to distribute possibly modified copies +.\" of this page provided the header is included verbatim, +.\" and in case of nontrivial modification author and date +.\" of the modification is added to the header. +.\" %%%LICENSE_END +.\" +.\" $Id: ip.7,v 1.19 2000/12/20 18:10:31 ak Exp $ +.\" +.\" FIXME The following socket options are yet to be documented +.\" +.\" IP_XFRM_POLICY (2.5.48) +.\" Needs CAP_NET_ADMIN +.\" +.\" IP_IPSEC_POLICY (2.5.47) +.\" Needs CAP_NET_ADMIN +.\" +.\" IP_MINTTL (2.6.34) +.\" commit d218d11133d888f9745802146a50255a4781d37a +.\" Author: Stephen Hemminger +.\" +.\" MCAST_JOIN_GROUP (2.4.22 / 2.6) +.\" +.\" MCAST_BLOCK_SOURCE (2.4.22 / 2.6) +.\" +.\" MCAST_UNBLOCK_SOURCE (2.4.22 / 2.6) +.\" +.\" MCAST_LEAVE_GROUP (2.4.22 / 2.6) +.\" +.\" MCAST_JOIN_SOURCE_GROUP (2.4.22 / 2.6) +.\" +.\" MCAST_LEAVE_SOURCE_GROUP (2.4.22 / 2.6) +.\" +.\" MCAST_MSFILTER (2.4.22 / 2.6) +.\" +.\" IP_UNICAST_IF (3.4) +.\" commit 76e21053b5bf33a07c76f99d27a74238310e3c71 +.\" Author: Erich E. Hoover +.\" +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.\" +.\" Japanese Version Copyright (c) 1999 NAKANO Takeo all rights reserved. +.\" Translated 1999-12-06, NAKANO Takeo +.\" Updated 2001-02-14, Kentaro Shirakata +.\" Updated 2001-04-04, Yuichi SATO +.\" Updated & Modified 2003-10-16, Yuichi SATO +.\" Updated & Modified 2005-01-22, Yuichi SATO +.\" Updated & Modified 2005-09-10, Akihiro MOTOKI +.\" Updated & Modified 2005-10-06, Akihiro MOTOKI +.\" Updated 2007-01-05, Akihiro MOTOKI, Catch up to LDP man-pages 2.43 +.\" Updated 2007-05-28, Akihiro MOTOKI , LDP v2.48 +.\" Updated 2008-12-26, Akihiro MOTOKI , LDP v3.14 +.\" Updated 2013-05-06, Akihiro MOTOKI +.\" Updated 2013-05-01, Akihiro MOTOKI +.\" +.TH IP 7 2020\-11\-01 Linux "Linux Programmer's Manual" +.SH 名前 +ip \- Linux IPv4 プロトコルの実装 +.SH 書式 +\fB#include \fP +.br +.\" .B #include -- does not exist anymore +.\" .B #include -- never include +\fB#include \fP +.br +\fB#include \fP/* 上記のスーパーセット */ +.PP +\fItcp_socket\fP\fB = socket(AF_INET, SOCK_STREAM, 0);\fP +.br +\fIudp_socket\fP\fB = socket(AF_INET, SOCK_DGRAM, 0);\fP +.br +\fIraw_socket\fP\fB = socket(AF_INET, SOCK_RAW, \fP\fIprotocol\fP\fB);\fP +.SH 説明 +Linux は RFC\ 791 と RFC\ 1122 で記述されている Internet Protocol, version 4 を実装している。 +\fBip\fP には RFC\ 1112 に準拠した level 2 マルチキャストの実装が含まれている。 またパケットフィルタ機能を含む IP +ルーターも実装されている。 +.PP +プログラミングインターフェースは BSD ソケットと互換である。 ソケットに関するより詳細な情報は \fBsocket\fP(7) を参照のこと。 +.PP +An IP socket is created using \fBsocket\fP(2): +.PP + socket(AF_INET, socket_type, protocol); +.PP +Valid socket types include \fBSOCK_STREAM\fP to open a stream socket, +\fBSOCK_DGRAM\fP to open a datagram socket, and \fBSOCK_RAW\fP to open a \fBraw\fP(7) +socket to access the IP protocol directly. +.PP +\fIprotocol\fP is the IP protocol in the IP header to be received or sent. +Valid values for \fIprotocol\fP include: +.IP \(bu 2 +0 and \fBIPPROTO_TCP\fP for \fBtcp\fP(7) stream sockets; +.IP \(bu +0 and \fBIPPROTO_UDP\fP for \fBudp\fP(7) datagram sockets; +.IP \(bu +\fBIPPROTO_SCTP\fP for \fBsctp\fP(7) stream sockets; and +.IP \(bu +\fBIPPROTO_UDPLITE\fP for \fBudplite\fP(7) datagram sockets. +.PP +For \fBSOCK_RAW\fP you may specify a valid IANA IP protocol defined in RFC\ 1700 assigned numbers. +.PP +あるプロセスで、やってくるパケットを受信したり 接続要求を受けたりしたい場合には、 そのプロセスはローカルなインターフェースアドレスに、 +\fBbind\fP(2) を用いてソケットをバインドしなければならない。 この場合、 ローカルの「アドレスとポート」のペアに対してバインドできる IP +ソケットは一つだけである。 \fBbind\fP(2) の呼び出しで \fBINADDR_ANY\fP が指定されていた場合は、 ソケットは \fIすべて\fP +のローカルインターフェースにバインドされる。 \fBlisten\fP(2) がバインドされていないソケットに対してコールされると、 そのソケットは、 +ローカルポートはランダムに選択された空いているポートで、 ローカルアドレスは \fBINADDR_ANY\fP で自動的にバインドされる。 +\fBconnect\fP(2) がバインドされていないソケットに対してコールされると、 そのソケットは、 +ローカルポートはランダムに選択された空いているポートか未使用の共有ポートで、 ローカルアドレスは \fBINADDR_ANY\fP で自動的にバインドされる。 +.PP +\fBSO_REUSEADDR\fP フラグがセットされていない場合には、 バインドされていた TCP ローカルソケットアドレスは +クローズされた後しばらくの間使えなくなる。 \fBSO_REUSEADDR\fP フラグを使うと TCP の信頼性を低下させるので、 +使うときには注意が必要である。 +.SS アドレスのフォーマット +IP ソケットアドレスは、 IP インターフェースアドレスと 16ビットのポート番号の組み合わせで定義される。 IP +プロトコルそのものはポート番号を扱わない。 ポート番号は、 \fBudp\fP(7) や \fBtcp\fP(7) といった、上位のプロトコルで実装される。 +raw ソケットでは、 \fIsin_port\fP が IP プロトコルにセットされる。 +.PP +.in +4n +.EX +struct sockaddr_in { + sa_family_t sin_family; /* address family: AF_INET */ + in_port_t sin_port; /* port in network byte order */ + struct in_addr sin_addr; /* internet address */ +}; + +/* Internet address. */ +struct in_addr { + uint32_t s_addr; /* address in network byte order */ +}; +.EE +.in +.PP +\fIsin_family\fP is always set to \fBAF_INET\fP. This is required; in Linux 2.2 +most networking functions return \fBEINVAL\fP when this setting is missing. +\fIsin_port\fP contains the port in network byte order. The port numbers below +1024 are called \fIprivileged ports\fP (or sometimes: \fIreserved ports\fP). Only +a privileged process (on Linux: a process that has the +\fBCAP_NET_BIND_SERVICE\fP capability in the user namespace governing its +network namespace) may \fBbind\fP(2) to these sockets. Note that the raw IPv4 +protocol as such has no concept of a port, they are implemented only by +higher protocols like \fBtcp\fP(7) and \fBudp\fP(7). +.PP +\fIsin_addr\fP is the IP host address. The \fIs_addr\fP member of \fIstruct +in_addr\fP contains the host interface address in network byte order. +\fIin_addr\fP should be assigned one of the \fBINADDR_*\fP values (e.g., +\fBINADDR_LOOPBACK\fP) using \fBhtonl\fP(3) or set using the \fBinet_aton\fP(3), +\fBinet_addr\fP(3), \fBinet_makeaddr\fP(3) library functions or directly with the +name resolver (see \fBgethostbyname\fP(3)). +.PP +.\" Leave a loophole for XTP @) +IPv4 アドレスには、ユニキャストアドレス、 ブロードキャストアドレス、マルチキャストアドレスがある。 +ユニキャストアドレスは、あるホストの一つのアドレスを指定する。 ブロードキャストアドレスは、あるネットワーク上の全てのホストを指定する。 +マルチキャストアドレスは、マルチキャストグループに所属する 全てのホストを指定する。ブロードキャストアドレスへのデータグラムは、 +\fBSO_BROADCAST\fP ソケットフラグがセットされていないと送信・受信できない。 +現在の実装では、接続指向のソケットにはユニキャストアドレスしか使えない。 +.PP +アドレスとポートは常にネットワークバイトオーダーで格納されることに注意せよ。 具体的には、ポートを指定する数値には \fBhtons\fP(3) +を呼び出す必要がある。 標準ライブラリにあるアドレス/ポート操作関数は すべてネットワークバイトオーダーで動作する。 +.PP +特別なアドレスがいくつか存在する: \fBINADDR_LOOPBACK\fP(127.0.0.1) は loopback +デバイスを通して常にローカルなホストを参照する。 \fBINADDR_ANY\fP(0.0.0.0) は任意のアドレスを意味し、バインド用である。 +\fBINADDR_BROADCAST\fP(255.255.255.255) は任意のホストを意味し、歴史的理由から、バインドの際には +\fBINADDR_ANY\fP と同じ効果になる。 +.SS ソケットオプション +.\" or SOL_IP on Linux +IP にはプロトコル固有のソケットオプションがいくつか存在し、 \fBsetsockopt\fP(2) で設定が、 \fBgetsockopt\fP(2) +で取得ができる。 IP のソケットオプションレベルは \fBIPPROTO_IP\fP である。 ブール整数値のフラグでは、 0 +は偽、それ以外は真を意味する。 +.PP +When an invalid socket option is specified, \fBgetsockopt\fP(2) and +\fBsetsockopt\fP(2) fail with the error \fBENOPROTOOPT\fP. +.TP +\fBIP_ADD_MEMBERSHIP\fP (Linux 1.2 以降) +マルチキャストグループに参加する。 引き数は \fIip_mreqn\fP 構造体である。 +.PP +.in +4n +.EX +struct ip_mreqn { + struct in_addr imr_multiaddr; /* IP multicast group + address */ + struct in_addr imr_address; /* IP address of local + interface */ + int imr_ifindex; /* interface index */ +}; +.EE +.in +.PP +.\" (i.e., within the 224.0.0.0-239.255.255.255 range) +\fIimr_multiaddr\fP には、アプリケーションが参加または脱退したい マルチキャストグループのアドレスが入る。 +指定するアドレスは有効なマルチキャストアドレスでなければならない (さもなければ \fBsetsockopt\fP(2) がエラー \fBEINVAL\fP +で失敗する)。 \fIimr_address\fP はシステムがマルチキャストグループに参加する際に用いる ローカルなインターフェースのアドレスである。 +これが \fBINADDR_ANY\fP であった場合には、適切なインターフェースがシステムによって選択される。 \fIimr_ifindex\fP は +\fIimr_multiaddr\fP グループに参加/脱退するインターフェースの interface index である。 +どのインターフェースでもよい場合は 0 にする。 +.IP +The \fIip_mreqn\fP structure is available only since Linux 2.2. For +compatibility, the old \fIip_mreq\fP structure (present since Linux 1.2) is +still supported; it differs from \fIip_mreqn\fP only by not including the +\fIimr_ifindex\fP field. (The kernel determines which structure is being +passed based on the size passed in \fIoptlen\fP.) +.IP +.\" +\fBIP_ADD_MEMBERSHIP\fP is valid only for \fBsetsockopt\fP(2). +.TP +\fBIP_ADD_SOURCE_MEMBERSHIP\fP (Linux 2.4.22 以降 / 2.5.68 以降) +マルチキャストグループに参加、指定された送信元からのデータの受信のみを許可する。 引き数は \fIip_mreq_source\fP 構造体である。 +.PP +.in +4n +.EX +struct ip_mreq_source { + struct in_addr imr_multiaddr; /* IP multicast group + address */ + struct in_addr imr_interface; /* IP address of local + interface */ + struct in_addr imr_sourceaddr; /* IP address of + multicast source */ +}; +.EE +.in +.PP +\fIip_mreq_source\fP 構造体は \fBIP_ADD_MEMBERSHIP\fP の項で説明した \fIip_mreqn\fP に似ている。 +\fIimr_multiaddr\fP フィールドには、アプリケーションが参加または脱退したいマルチキャストグループのアドレスが入る。 +\fIimr_interface\fP フィールドは、 マルチキャストグループに参加する際に システムが使用すべきローカルインターフェースのアドレスである。 +\fIimr_sourceaddr\fP フィールドには、アプリケーションがデータを受信したい送信元のアドレスが入る。 +.IP +このオプションを複数回使うことで、 複数の送信元からのデータ受信を許可することができる。 +.TP +\fBIP_BIND_ADDRESS_NO_PORT\fP (Linux 4.2 以降) +.\" commit 90c337da1524863838658078ec34241f45d8394d +Inform the kernel to not reserve an ephemeral port when using \fBbind\fP(2) +with a port number of 0. The port will later be automatically chosen at +\fBconnect\fP(2) time, in a way that allows sharing a source port as long as +the 4\-tuple is unique. +.TP +\fBIP_BLOCK_SOURCE\fP (since Linux 2.4.22 以降 / 2.5.68 以降) +指定したグループで、指定した送信元からのマルチキャストデータの受信を停止する。 このオプションは、アプリケーションが +\fBIP_ADD_MEMBERSHIP\fP か \fBIP_ADD_SOURCE_MEMBERSHIP\fP +のいずれかを使ってマルチキャストグループに参加した後でのみ有効である。 +.IP +引き数は \fIip_mreq_source\fP 構造体である。 \fBIP_ADD_SOURCE_MEMBERSHIP\fP の項に説明がある。 +.TP +\fBIP_DROP_MEMBERSHIP\fP (Linux 1.2 以降) +マルチキャストグループから抜ける。引き数は \fBIP_ADD_MEMBERSHIP\fP と同様に \fIip_mreqn\fP または \fIip_mreq\fP +構造体である。 +.TP +\fBIP_DROP_SOURCE_MEMBERSHIP\fP (Linux 2.4.22 以降 / 2.5.68 以降) +送信元を指定してグループから抜ける。 つまり、 指定したマルチキャストグループの指定された送信元からのデータ受信を停止する。 +アプリケーションは同じマルチキャストグループで複数の送信元を購読 (subscribe) している場合には、 +残りの送信元からのデータの受信は引き続き配信される。 すべての送信元からのデータ受信を一度で停止するには \fBIP_DROP_MEMBERSHIP\fP +を使うこと。 +.IP +引き数は \fIip_mreq_source\fP 構造体である。 \fBIP_ADD_SOURCE_MEMBERSHIP\fP の項に説明がある。 +.TP +\fBIP_FREEBIND\fP (Linux 2.4 以降) +.\" Precisely: 2.4.0-test10 +このブール値のオプションを有効にすると、ローカルではない IP アドレスや存在 +しない IP アドレスをバインドできるようになる。これを使うと、対応するネット +ワークインターフェイスがなかったり、アプリケーションがソケットをバインドしようと +する時点で特定の動的 IP アドレスが有効になっていなかったりしても、ソケットを +接続待ち状態 (listening) にできるようになる。 +このオプションは、下記に説明がある \fIip_nonlocal_bind\fP \fI/proc\fP インターフェイス +のソケット単位の設定である。 +.TP +\fBIP_HDRINCL\fP (Linux 2.0 以降) +If enabled, the user supplies an IP header in front of the user data. Valid +only for \fBSOCK_RAW\fP sockets; see \fBraw\fP(7) for more information. When +this flag is enabled, the values set by \fBIP_OPTIONS\fP, \fBIP_TTL\fP, and +\fBIP_TOS\fP are ignored. +.TP +\fBIP_MSFILTER\fP (since Linux 2.4.22 以降 / 2.5.68 以降) +このオプションを使うと、 高度なフィルタリング API へアクセスできる。 この API ではすべての状態にアクセスできる。 引き数は +\fIip_msfilter\fP 構造体である。 +.PP +.in +4n +.EX +struct ip_msfilter { + struct in_addr imsf_multiaddr; /* IP multicast group + address */ + struct in_addr imsf_interface; /* IP address of local + interface */ + uint32_t imsf_fmode; /* Filter\-mode */ + + uint32_t imsf_numsrc; /* Number of sources in + the following array */ + struct in_addr imsf_slist[1]; /* Array of source + addresses */ +}; +.EE +.in +.PP +\fBMCAST_INCLUDE\fP と \fBMCAST_EXCLUDE\fP の 2 つのマクロがあり、 フィルタリングモードを指定するのに使用できる。 +また、 \fBIP_MSFILTER_SIZE\fP(n) マクロがあり、 送信元リストに \fIn\fP 個の送信元が入った \fIip_msfilter\fP +構造体を格納するのに必要なメモリー量を判定することができる。 +.IP +マルチキャスト送信元フィルタリングの全容は RFC\ 3376 を参照のこと。 +.TP +\fBIP_MTU\fP (Linux 2.2 以降) +.\" Precisely: 2.1.124 +Retrieve the current known path MTU of the current socket. Returns an +integer. +.IP +\fBIP_MTU\fP is valid only for \fBgetsockopt\fP(2) and can be employed only when +the socket has been connected. +.TP +\fBIP_MTU_DISCOVER\fP (Linux 2.2 以降) +.\" Precisely: 2.1.124 +ソケットの Path MTU Discovery の設定をセット・取得する。 +有効になっていると、Linux は \fBSOCK_STREAM\fP ソケットに対して +RFC\ 1191 で定義されている Path MTU Discovery を行う。 +\fBSOCK_STREAM\fP でないソケットについては、 \fBIP_PMTUDISC_DO\fP をセットすると、 +全ての送信パケットでフラグメント不許可フラグ (don't\-fragment flag) が必ず +セットされるようになる。 \fBSOCK_STREAM\fP でないソケットでは、 +パケットを MTU のサイズの塊に分割したり、必要に応じて再送したりするのは、 +ユーザーが責任を持って行う必要がある。 +既知の Path MTU よりも大きなデータグラムの送信が要求されると、 +カーネルは (\fBEMSGSIZE\fP で) 送信を拒否する。 +\fBIP_PMTUDISC_WANT\fP の場合は、 Path MTU に基づいて必要であればデータグラム +の分割が行われ、それ以外の場合はフラグメント不許可フラグがセットされる。 +.IP +システム全体のデフォルトは \fBIP_PMTUDISC_WANT\fP と \fBIP_PMTUDISC_DONT\fP の +どちらかに設定することができる。設定の変更は、 +\fI/proc/sys/net/ipv4/ip_no_pmtu_disc\fP ファイルに、0 (\fBIP_PMTUDISC_WANT\fP) か +0 以外 (\fBIP_PMTUDISC_DONT\fP) を書き込むことで行う。 +.TS +tab(:); +c l +l l. +Path MTU discovery 値:意味 +IP_PMTUDISC_WANT:ルートごとの設定を用いる。 +IP_PMTUDISC_DONT:Path MTU Discovery を行わない。 +IP_PMTUDISC_DO:常に Path MTU Discovery を行う。 +IP_PMTUDISC_PROBE:DFビットをセットするが、Path MTU を無視する。 +.TE +.sp 1 +path MTU discovery が有効になっていると、カーネルは宛先ホストごとに 自動的に +path MTU を処理する。特定の相手に \fBconnect\fP(2) で接続した場合には、 +\fBIP_MTU\fP ソケットオプションを用いれば、既知の path MTU の取得に便利である +(たとえば \fBEMSGSIZE\fP エラーが起きた後など)。 path MTU は時間とともに変化する +かもしれない。 宛先がたくさんあるコネクションレスなソケットでは、 与えられた +宛先に対する新しい MTU にも、 エラーキューを用いてアクセスすることができる +(\fBIP_RECVERR\fP を見よ)。 MTU 更新が到着するごとに、新たなエラーがキューイング +される。 +.IP +MTU discovery の進行中には、データグラムソケットからの初期パケットは 到着しないかもしれない。 UDP を用いるアプリケーションでは、 +このことを気にかけておき、 パケットの再送アルゴリズムにこの分を除外させるべきである。 +.IP +To bootstrap the path MTU discovery process on unconnected sockets, it is +possible to start with a big datagram size (headers up to 64 kilobytes long) +and let it shrink by updates of the path MTU. +.IP +path MTU の値をまず見積もってみるには、宛先アドレスに \fBconnect\fP(2) を使ってデータグラムソケットを接続し、 +\fBgetsockopt\fP(2) を \fBIP_MTU\fP オプションとともに呼び、 MTU を取得することである。 +.IP +\fBIP_PMTUDISC_PROBE\fP (Linux 2.6.22 以降で利用可能) を設定することで、 \fBSOCK_DGRAM\fP や +\fBSOCK_RAW\fP のソケットで RFC 4821 の MTU 探索を実装することが可能である。 また、この機能は、 \fBtracepath\fP(8) +のような診断ツールで特に有用である。これらのツールでは、 観測された Path MTU よりも大きな探索パケットを意図的に 送信しようとする。 +.TP +\fBIP_MULTICAST_ALL\fP (Linux 2.6.31 以降) +このオプションを使って、 マルチキャストメッセージの、 ワイルドカードの \fBINADDR_ANY\fP アドレスにバインドされているソケットへの +配送ポリシーを変更することができる。 引き数はブート値の整数で、 デフォルト値は 1 である。 このオプションを 1 +に設定されている場合、そのソケットでは、このシステムで参加しているすべてのグループからのメッセージが受信される。 それ以外の場合は、そのソケットでは、 +そのソケットに対して (\fBIP_ADD_MEMBERSHIP\fP などを使って) 明示的に参加が指定されたグループからのメッセージだけが受信される。 +.TP +\fBIP_MULTICAST_IF\fP (Linux 1.2 以降) +.\" net: IP_MULTICAST_IF setsockopt now recognizes struct mreq +.\" Commit: 3a084ddb4bf299a6e898a9a07c89f3917f0713f7 +Set the local device for a multicast socket. The argument for +\fBsetsockopt\fP(2) is an \fIip_mreqn\fP or (since Linux 3.5) \fIip_mreq\fP +structure similar to \fBIP_ADD_MEMBERSHIP\fP, or an \fIin_addr\fP structure. (The +kernel determines which structure is being passed based on the size passed +in \fIoptlen\fP.) For \fBgetsockopt\fP(2), the argument is an \fIin_addr\fP +structure. +.TP +\fBIP_MULTICAST_LOOP\fP (Linux 1.2 以降) +マルチキャストパケットをローカルなソケットにループバックするかどうかを 定めるブール値の整数引き数を設定・取得する。 +.TP +\fBIP_MULTICAST_TTL\fP (Linux 1.2 以降) +このソケットから発信されるマルチキャストパケットの time\-to\-live 値を設定・取得する。 マルチキャストパケットに対しては、できるだけ小さな +TTL に設定することがとても重要である。デフォルトは 1 で、 ユーザープログラムが明示的に要求しない限り +マルチキャストパケットはローカルなネットワークから出ないことになる。 引き数に整数を取る。 +.TP +\fBIP_NODEFRAG\fP (Linux 2.6.36 以降) +If enabled (argument is nonzero), the reassembly of outgoing packets is +disabled in the netfilter layer. The argument is an integer. +.IP +This option is valid only for \fBSOCK_RAW\fP sockets. +.TP +\fBIP_OPTIONS\fP (Linux 2.0 以降) +.\" Precisely: 1.3.30 +このソケットから送られるパケット全てに付随する IP オプションを 設定・取得する。オプションを保存しているメモリーバッファーへのポインターと +オプションの長さとを引き数に取る。 \fBsetsockopt\fP(2) を呼び出すと、ソケットに関連づけられる IP オプションを設定できる。 IPv4 +におけるオプションのサイズの最大値は 40 バイトである。 用いることのできるオプションについては RFC\ 791 を見よ。 +\fBSOCK_STREAM\fP ソケットに対する初期接続要求パケットに IP オプションが含まれていると、 +ルーティングヘッダーを付けて戻されてくる初期パケットの IP オプションに同じオプションがセットされる。接続が確立された後、 +やってきたパケットのオプションを変更することはできない。 デフォルトでは。外部から受信したパケットの全ての source routing オプション +の処理は無効となっており、 \fI/proc\fP インターフェースの \fIaccept_source_route\fP +を使うとこれを有効にできる。これを無効にしていても timestamps など の他のオプションの処理は行われる。データグラムソケットでは、 IP +オプションはローカルユーザーしか設定できない。 \fBgetsockopt\fP(2) を \fBIP_OPTIONS\fP +をつけて呼ぶと、現在送信に用いられている IP オプションを 引き数に与えたバッファーに取得できる。 +.TP +\fBIP_PASSSEC\fP (Linux 2.6.17 以降) +.\" commit 2c7946a7bf45ae86736ab3b43d0085e43947945c +If labeled IPSEC or NetLabel is configured on the sending and receiving +hosts, this option enables receiving of the security context of the peer +socket in an ancillary message of type \fBSCM_SECURITY\fP retrieved using +\fBrecvmsg\fP(2). This option is supported only for UDP sockets; for TCP or +SCTP sockets, see the description of the \fBSO_PEERSEC\fP option below. +.IP +The value given as an argument to \fBsetsockopt\fP(2) and returned as the +result of \fBgetsockopt\fP(2) is an integer boolean flag. +.IP +The security context returned in the \fBSCM_SECURITY\fP ancillary message is of +the same format as the one described under the \fBSO_PEERSEC\fP option below. +.IP +Note: the reuse of the \fBSCM_SECURITY\fP message type for the \fBIP_PASSSEC\fP +socket option was likely a mistake, since other IP control messages use +their own numbering scheme in the IP namespace and often use the socket +option value as the message type. There is no conflict currently since the +IP option with the same value as \fBSCM_SECURITY\fP is \fBIP_HDRINCL\fP and this +is never used for a control message type. +.TP +\fBIP_PKTINFO\fP (Linux 2.2 以降) +.\" Precisely: 2.1.68 +\fBIP_PKTINFO\fP 補助メッセージを渡す。これには到着パケットに関する情報を提供する \fIpktinfo\fP 構造体が含まれている。 +データグラム指向のソケットでしか動作しない。 引き数は \fBIP_PKTINFO\fP メッセージを通過させるかどうかをソケットに知らせるフラグである。 +メッセージ自身は \fBrecvmsg\fP(2) または \fBsendmsg\fP(2) を用いたパケットの制御メッセージとしてのみ送受信できる。 +.IP +.in +4n +.EX +struct in_pktinfo { + unsigned int ipi_ifindex; /* Interface index */ + struct in_addr ipi_spec_dst; /* Local address */ + struct in_addr ipi_addr; /* Header Destination + address */ +}; +.EE +.in +.IP +.\" This field is grossly misnamed +\fIipi_ifindex\fP はパケットが受信されたインターフェースの、他と重ならないインデックスである。 \fIipi_spec_dst\fP +はパケットのローカルアドレスである。 \fIipi_addr\fP はパケットヘッダーにある宛先アドレスである。 \fBIP_PKTINFO\fP が +\fBsendmsg\fP(2) に渡されて、かつ \fIipi_spec_dst\fP が 0 以外の場合、 \fIipi_spec_dst\fP +はルーティングテーブルを検索する際にローカルな送信元アドレスとして使用され、 IP source route オプションを設定するのにも使用される。 +\fIipi_ifindex\fP が 0 以外の場合、このインデックスによって指定されるインターフェースの プライマリローカルアドレスで +\fIipi_spec_dst\fP を上書きし、ルーティングテーブルを検索する。 +.TP +\fBIP_RECVERR\fP (Linux 2.2 以降) +.\" Precisely: 2.1.15 +.\" or SOL_IP on Linux +エラーメッセージの受け渡しに、信頼性の高い拡張された方法を有効にする。 データグラムソケットに対して有効になっていると、 +発生したエラーは全てソケットごとのエラーキューに保存される。 ユーザーはソケット操作からエラーを受け取ったとき、 \fBrecvmsg\fP(2) を +\fBMSG_ERRQUEUE\fP フラグとともに呼べばそのエラーを取得できる。 そのエラーを記述する \fIsock_extended_err\fP +構造体が、タイプ \fBIP_RECVERR\fP・ レベル \fBIPPROTO_IP\fP の補助メッセージとして渡される。 +これは接続志向でないソケットで信頼性の高いエラー処理を行いたい場合に 有用である。エラーキューの受信データフラグメントには エラーパケットが含まれる。 +.IP +\fBIP_RECVERR\fP 制御メッセージには \fIsock_extended_err\fP 構造体が含まれる: +.IP +.in +4n +.EX +#define SO_EE_ORIGIN_NONE 0 +#define SO_EE_ORIGIN_LOCAL 1 +#define SO_EE_ORIGIN_ICMP 2 +#define SO_EE_ORIGIN_ICMP6 3 + +struct sock_extended_err { + uint32_t ee_errno; /* error number */ + uint8_t ee_origin; /* where the error originated */ + uint8_t ee_type; /* type */ + uint8_t ee_code; /* code */ + uint8_t ee_pad; + uint32_t ee_info; /* additional information */ + uint32_t ee_data; /* other data */ + /* More data may follow */ +}; + +struct sockaddr *SO_EE_OFFENDER(struct sock_extended_err *); +.EE +.in +.IP +\fIee_errno\fP にはキューに入っているエラーの \fIerrno\fP 番号が入る。 \fIee_origin\fP +にはエラーが発生した場所を示すコードが入る。 その他のフィールドはプロトコル依存である。 \fBSO_EE_OFFENDER\fP +マクロは与えられた補助メッセージへのポインターから エラーの発生したネットワークオブジェクトのアドレスへのポインターを返す。 アドレスが不明な場合、 +\fIsockaddr\fP 構造体の \fIsa_family\fP フィールドは \fBAF_UNSPEC\fP となり、その他のフィールド値は不定である。 +.IP +.\" FIXME . Is it a good idea to document that? It is a dubious feature. +.\" On +.\" .B SOCK_STREAM +.\" sockets, +.\" .B IP_RECVERR +.\" has slightly different semantics. Instead of +.\" saving the errors for the next timeout, it passes all incoming +.\" errors immediately to the user. +.\" This might be useful for very short-lived TCP connections which +.\" need fast error handling. Use this option with care: +.\" it makes TCP unreliable +.\" by not allowing it to recover properly from routing +.\" shifts and other normal +.\" conditions and breaks the protocol specification. +IP は以下のような \fIsock_extended_err\fP 構造体を用いる: \fIee_origin\fP は、エラー +が ICMP パケットとして受信された場合には \fBSO_EE_ORIGIN_ICMP\fP にセットされ、 +ローカルで起こった場合には \fBSO_EE_ORIGIN_LOCAL\fP にセットされる。 不明な値は +無視される。 \fIee_type\fP と \fIee_code\fP は ICMP ヘッダーの type フィールドと +code フィールドの値にセットされる。 \fIee_info\fP には \fBEMSGSIZE\fP エラーに対す +る discover された MTU が入る。 メッセージにはエラーを引き起こしたノードの +\fIsockaddr_in\fP 構造体も含まれる。 これには \fBSO_EE_OFFENDER\fP マクロを使ってア +クセスできる。 ソースが不明の場合、 \fBSO_EE_OFFENDER\fP アドレスの +\fIsin_family\fP フィールドは \fBAF_UNSPEC\fP となる。 エラーがネットワークで起きた +場合には、 ソケットで有効になっていたすべての IP オプション (\fBIP_OPTIONS\fP, +\fBIP_TTL\fP など) とエラーパケットに含まれていたすべての IP オプションとが、 制 +御メッセージとして渡される。 エラーを起こしたパケットのペイロード (payload) +は 普通のペイロードとして返される。 TCP にはエラーキューがないことに注意して +ほしい。 \fBMSG_ERRQUEUE\fP は \fBSOCK_STREAM\fP ソケットに対しては使えない。 TCP +では \fBIP_RECVERR\fP だけが有効だが、ソケット関数から返されるエラーは +\fBSO_ERROR\fP だけになる。 +.IP +raw ソケットに対して \fBIP_RECVERR\fP を指定すると、受信したすべての ICMP エラーをアプリケーションに +渡すようになる。指定しないと、 接続済みのソケットに対するエラーだけを報告する。 +.IP +このオプションはブール値のフラグを設定・取得する。 \fBIP_RECVERR\fP はデフォルトではオフになっている。 +.TP +\fBIP_RECVOPTS\fP (Linux 2.2 以降) +.\" Precisely: 2.1.15 +到着した全ての IP オプションを \fBIP_OPTION\fP コントロールメッセージに入れてユーザーに渡す。 +ルーティングヘッダーとその他のオプションとは、 ローカルホストに対してはあらかじめ記入されている。 \fBSOCK_STREAM\fP +ソケットではサポートされていない。 +.TP +\fBIP_RECVORIGDSTADDR\fP (Linux 2.6.29 以降) +.\" commit e8b2dfe9b4501ed0047459b2756ba26e5a940a69 +このブール値のオプションがセットされると、 +\fBrecvmsg\fP(2) で \fBIP_ORIGDSTADDR\fP 補助メッセージが有効になる。 +カーネルはデータグラムを受信した元の宛先アドレスをこの補助メッセージで返す。 +この補助メッセージには \fIstruct sockaddr_in\fP が格納される。 +.TP +\fBIP_RECVTOS\fP (Linux 2.2 以降) +.\" Precisely: 2.1.68 +有効になっていると、 \fBIP_TOS\fP 補助メッセージが到着パケットとともに渡される。 これにはパケットヘッダーの +Service/Precedence フィールドのタイプを指定するバイトデータが含まれている。 ブール整数値のフラグをとる。 +.TP +\fBIP_RECVTTL\fP (Linux 2.2 以降) +.\" Precisely: 2.1.68 +When this flag is set, pass a \fBIP_TTL\fP control message with the +time\-to\-live field of the received packet as a 32 bit integer. Not +supported for \fBSOCK_STREAM\fP sockets. +.TP +\fBIP_RETOPTS\fP +.\" Precisely: 2.1.15 +\fBIP_RETOPTS\fP (Linux 2.2 以降) \fBIP_RECVOPTS\fP と等価だが、未処理の生のオプションを、 この hop +では記入されない timestamp レコードと route レコードとともに返す。 +.TP +\fBIP_ROUTER_ALERT\fP (Linux 2.2 以降) +.\" Precisely: 2.1.68 +Pass all to\-be forwarded packets with the IP Router Alert option set to this +socket. Valid only for raw sockets. This is useful, for instance, for +user\-space RSVP daemons. The tapped packets are not forwarded by the +kernel; it is the user's responsibility to send them out again. Socket +binding is ignored, such packets are filtered only by protocol. Expects an +integer flag. +.TP +\fBIP_TOS\fP (Linux 1.0 以降) +.\" FIXME elaborate on this +.\" The priority can also be set in a protocol-independent way by the +.\" .RB ( SOL_SOCKET ", " SO_PRIORITY ) +.\" socket option (see +.\" .BR socket (7)). +このソケットから送信されるすべての IP パケットに適用される Type\-Of\-Service (TOS) フィールドを設定・取得する。 +これはネットワーク上でのパケットの優先度を決めるために用いられる。 TOS はバイトデータである。標準の TOS フラグがいくつか定義されている。 +\fBIPTOS_LOWDELAY\fP はインタラクティブなトラフィックの遅延を最小にする。 \fBIPTOS_THROUGHPUT\fP +はスループットを最大にする。 \fBIPTOS_RELIABILITY\fP は信頼性を最高にする。 \fBIPTOS_MINCOST\fP +は転送速度が遅くてもかまわないとき、「データを詰め込む」のに用いられる。 これらのうち、 1 つまでだけを設定できる。 +他のビットは無効で、クリアされる。 Linux はデフォルトでは \fBIPTOS_LOWDELAY\fP データグラムを最初に送信する。 +しかし、正確な振る舞いはキュー処理の設定に依存する。 高い優先度にするにはスーパーユーザー権限 (\fBCAP_NET_ADMIN\fP ケーパビリティ) +が必要となるかもしれない。 +.TP +\fBIP_TRANSPARENT\fP (Linux 2.6.24 以降) +.\" commit f5715aea4564f233767ea1d944b2637a5fd7cd2e +.\" This patch introduces the IP_TRANSPARENT socket option: enabling that +.\" will make the IPv4 routing omit the non-local source address check on +.\" output. Setting IP_TRANSPARENT requires NET_ADMIN capability. +.\" http://lwn.net/Articles/252545/ +このブール値のオプションを有効にすると、 このソケットで透過プロキシ (transparent proxy) ができるようになる。 +このソケットオプションを使うと、呼び出したアプリケーションは、 ローカルではない IP アドレスをバインドして、ローカルの端点として自分以外のアドレス +(foreign address) を持つクライアントやサーバの両方として動作できるようになる。 \fB注意\fP: +この機能が動作するためには、自分以外のアドレス宛のパケットが透過プロキシが動作するマシン (すなわちソケットオプション +\fBIP_TRANSPARENT\fP を利用するアプリケーションが動作しているシステム) 経由で転送されるように、 ルーティングが設定される必要がある。 +このソケットオプションを有効にするには、スーパーユーザー特権 (\fBCAP_NET_ADMIN\fP ケーパビリティ) が必要である。 +.IP +iptables の TPROXY ターゲットで透過プロキシリダイレクション +(TProxy redirection) を行うには、リダイレクトされるソケットに対して +このオプションを設定する必要がある。 +.TP +\fBIP_TTL\fP (Linux 1.0 以降) +time\-to\-live フィールドの値を設定または取得する。 この値はこのソケットから送信されるすべてのパケットに用いられる。 +.TP +\fBIP_UNBLOCK_SOURCE\fP (Linux 2.4.22 以降 / 2.5.68 以降) +それ以前はブロックされていたマルチキャストの送信元のブロックを解除する。 指定した送信元がブロックされていない場合は \fBEADDRNOTAVAIL\fP +を返す。 +.IP +引き数は \fIip_mreq_source\fP 構造体である。 \fBIP_ADD_SOURCE_MEMBERSHIP\fP の項に説明がある。 +.TP +\fBSO_PEERSEC\fP (Linux 2.6.17 以降) +If labeled IPSEC or NetLabel is configured on both the sending and receiving +hosts, this read\-only socket option returns the security context of the peer +socket connected to this socket. By default, this will be the same as the +security context of the process that created the peer socket unless +overridden by the policy or by a process with the required permissions. +.IP +The argument to \fBgetsockopt\fP(2) is a pointer to a buffer of the specified +length in bytes into which the security context string will be copied. If +the buffer length is less than the length of the security context string, +then \fBgetsockopt\fP(2) returns \-1, sets \fIerrno\fP to \fBERANGE\fP, and returns +the required length via \fIoptlen\fP. The caller should allocate at least +\fBNAME_MAX\fP bytes for the buffer initially, although this is not guaranteed +to be sufficient. Resizing the buffer to the returned length and retrying +may be necessary. +.IP +The security context string may include a terminating null character in the +returned length, but is not guaranteed to do so: a security context "foo" +might be represented as either {'f','o','o'} of length 3 or +{'f','o','o','\e0'} of length 4, which are considered to be +interchangeable. The string is printable, does not contain non\-terminating +null characters, and is in an unspecified encoding (in particular, it is not +guaranteed to be ASCII or UTF\-8). +.IP +.\" commit 2c7946a7bf45ae86736ab3b43d0085e43947945c +.\" commit d452930fd3b9031e59abfeddb2fa383f1403d61a +The use of this option for sockets in the \fBAF_INET\fP address family is +supported since Linux 2.6.17 for TCP sockets, and since Linux 4.17 for SCTP +sockets. +.IP +.\" +For SELinux, NetLabel conveys only the MLS portion of the security context +of the peer across the wire, defaulting the rest of the security context to +the values defined in the policy for the netmsg initial security identifier +(SID). However, NetLabel can be configured to pass full security contexts +over loopback. Labeled IPSEC always passes full security contexts as part +of establishing the security association (SA) and looks them up based on the +association for each packet. +.SS "/proc インターフェース" +.\" FIXME As at 2.6.12, 14 Jun 2005, the following are undocumented: +.\" ip_queue_maxlen +.\" ip_conntrack_max +.\" +IP プロトコルでは、いくつかのグローバルパラメーターを設定するための \fI/proc\fP ファイル群が用意されている。 これらのパラメーターには、 +\fI/proc/sys/net/ipv4/\fP ディレクトリ内のファイルの読み書きでアクセスできる。 \fIBoolean\fP +と書かれたインターフェースは整数値をとり、 0 以外の値 ("true") は対応するオプションが有効、 0 値 ("false") +は無効、であることを意味する。 +.TP +\fIip_always_defrag\fP (Boolean; Linux 2.2.13 以降) +[2.2.13 で新規登場。以前のバージョンのカーネルでは、この機能は コンパイル時に \fBCONFIG_IP_ALWAYS_DEFRAG\fP +オプションによって制御されていた; このファイルは 2.4.x 以降では存在しない] +.IP +このブール値のフラグが有効になっている (0 以外になっている) と、 到着したフラグメント (IP パケットの一部で、 +発信元と発信先の間のどこかのホストで、そのパケットが 大きすぎると判断され、分割された場合に生じる) は、たとえフォワードされる場合であっても +処理前に再構築 (デフラグメント) される。 +.IP +ファイアウォールがローカル側のネットワークに唯一のリンクを持っている 場合や、透過プロクシの場合に限って有効にすべきである。 +通常のルーターやホストでは決して使用することのないように。 さもないとフラグメントが別のリンクを経由して伝わる場合に、 +通信のフラグメント化ができなくなってしまう。 またフラグメント再構築処理はメモリーと CPU 時間のコストが非常に大きい。 +.IP +.\" +これはマスカレードや透過プロクシが設定されると、 不思議な仕組みによって自動的に有効になる。 +.TP +\fIip_autoconfig\fP (Linux 2.2 以降 2.6.17 まで) +.\" Precisely: since 2.1.68 +.\" FIXME document ip_autoconfig +.\" +まだ記述していない。 +.TP +\fIip_default_ttl\fP (integer; default: 64; Linux 2.2 以降) +.\" Precisely: 2.1.15 +.\" +送出されるパケットの time\-to\-live 値のデフォルトをセットする。 これは \fBIP_TTL\fP +オプションを用いれば、パケットごとに変えることもできる。 +.TP +\fIip_dynaddr\fP (ブール値; デフォルト: 無効; Linux 2.0.31 以降) +.\" +動的ソケットアドレスと、インターフェースアドレスが変更された際の マスカレードエントリーの再書き込みを有効にする。 ダイアルアップインターフェースで、 +IP アドレスが変更される場合に便利である。 +.TP +\fIip_forward\fP (ブール値; デフォルト: 無効; Linux 1.2 以降) +.\" +IP forwarding を有効にするかどうかのブール値フラグ。 IP forwarding するかどうかはインターフェースごとにも設定できる。 +.TP +\fIip_local_port_range\fP (Linux 2.2 以降) +.\" Precisely: since 2.1.68 +このファイルには、 ポート番号に明示的にバインドされないソケットに割り当てられるデフォルトのローカルポートの範囲 \(em つまり「一時ポート +(\fIephemeral ports\fP)」に使用される範囲 \(em を定める 2 つの整数が入っている。 +一時ポートは以下の場合にソケットに割り当てられる。 +.RS +.IP * 3 +\fBbind\fP(2) の呼び出し時にソケットアドレスのポート番号に 0 が指定されている。 +.IP * +バインドされていないストリームソケットに対して \fBlisten\fP(2) が呼び出された。 +.IP * +バインドされていないソケットに対して \fBconnect\fP(2) が呼ばれた。 +.IP * +バインドされていないデータグラムソケットに対して \fBsendto\fP(2) が呼ばれた。 +.RE +.IP +一時ポートに割り当てられるポート番号の範囲は、 \fIip_local_port_range\fP の最初の数字から始まり、 2 番目の数字で終わる。 +一時ポートの範囲を使い切った場合、 関連するシステムコールはエラーを返す (バグの節を参照)。 +.IP +.\" +\fIip_local_port_range\fP で指定するポート番号の範囲は、 マスカレードで用いられているポートと重なってはならない +(その場合も取り扱われるが)。 ファイアウォールのパケットフィルターが「利用中のローカルポート」 について何らかの仮定をしている場合には、 +番号を勝手に決めてしまうと問題が起きるかもしれない。 1 番目の番号は少なくとも 1024 より大きくすべきである。 +良く使われるポートとの衝突を避けたり、ファイアウォールの問題を 回避したければ、 4096 よりも大きくするほうが良いだろう。 +.TP +\fIip_no_pmtu_disc\fP (ブール値; デフォルト: 無効; Linux 2.2 以降) +.\" Precisely: 2.1.15 +.\" +.\" The following is from 2.6.12: Documentation/networking/ip-sysctl.txt +有効になっていると、デフォルトで TCP ソケットに対する Path MTU Discoverty を行わない。 Path MTU Discovery +は、 正しく設定されていない (ICMP パケットを全てドロップする) ファイアウォールや、 (point\-to\-point リンクで双方の MTU +が一致していない場合など) 正しく設定されていないインターフェースが経路上に存在すると失敗してしまう。 Path MTU Discovery +をグローバルに無効にするよりは、 壊れているルーターを直すほうが良い。 Path MTU Discovery を無効にするとネットワークのコストが +大きくなってしまうからである。 +.TP +\fIip_nonlocal_bind\fP (ブール値; デフォルト: 無効; Linux 2.4 以降) +.\" Precisely: patch-2.4.0-test10 +.\" +.\" The following is from 2.6.12: Documentation/networking/ip-sysctl.txt +セットされていれば、プロセスが自分以外の IP アドレスを \fBbind\fP(2) +できるようになる。これはかなり便利だが、うまく動かないアプリケーションもある。 +.TP +\fIip6frag_time\fP (integer; default: 30) +.\" +.\" The following is from 2.6.12: Documentation/networking/ip-sysctl.txt +IPv6 フラグメントをメモリーに保持しておく時間 (秒単位)。 +.TP +\fIip6frag_secret_interval\fP (integer; default: 600) +IPv6 フラグメントの hash secret の生成間隔 (hash secret の寿命) (秒単位)。 +.TP +\fIipfrag_high_thresh\fP (integer), \fIipfrag_low_thresh\fP (integer) +キューイングされている IP フラグメントの量が \fIipfrag_high_thresh\fP に達すると、キューの内容は +\fIipfrag_low_thresh\fP にまで切り捨てられる。それぞれの大きさを バイト単位で表す整数値が入っている。 +.TP +\fIneigh/*\fP +.\" FIXME Document the conf/*/* interfaces +.\" +.\" FIXME Document the route/* interfaces +\fBarp\fP(7) を見よ。 +.SS ioctl +\fBsocket\fP(7) に記述されている ioctl は、すべて \fBip\fP にも適用される。 +.PP +.\" FIXME Add a discussion of multicasting +ジェネリックデバイスのパラメーターを設定する ioctl については \fBnetdevice\fP(7) に記述されている。 +.SH エラー +.\" FIXME document all errors. +.\" We should really fix the kernels to give more uniform +.\" error returns (ENOMEM vs ENOBUFS, EPERM vs EACCES etc.) +.TP +\fBEACCES\fP +必要な権限のないユーザーが操作を実行しようとした。 以下のような場合が考えられる: \fBSO_BROADCAST\fP +フラグを設定していない状態でブロードキャストアドレスに パケットを送ろうとした。 \fIprohibit\fP なルートを通してパケットを送ろうとした。 +スーパーユーザー権限 (\fBCAP_NET_ADMIN\fP ケーパビリティ) なしでファイアウォールの設定を変更しようとした。 スーパーユーザー権限 +(\fBCAP_NET_BIND_SERVICE\fP ケーパビリティ) なしで特権ポートにバインドしようとした。 +.TP +\fBEADDRINUSE\fP +既に使用されているアドレスにバインドしようとした。 +.TP +\fBEADDRNOTAVAIL\fP +存在しないインターフェースが要求された。または 要求されたソースアドレスがローカルでない。 +.TP +\fBEAGAIN\fP +非ブロッキングソケットに対してブロックする操作を行った。 +.TP +\fBEALREADY\fP +非ブロッキングソケットに対する接続操作が既に実行中である。 +.TP +\fBECONNABORTED\fP +\fBaccept\fP(2) の途中で接続がクローズされた。 +.TP +\fBEHOSTUNREACH\fP +宛先アドレスにマッチする有効なエントリーがルーティングテーブルに 存在しない。このエラーはリモートルーターからの、 +あるいはローカルルーティングテーブルへの ICMP メッセージによって引き起こされることがある。 +.TP +\fBEINVAL\fP +不正な引き数が渡された。送信操作において、 \fIblackhole\fP ルートに送信しようとするとこのエラーが起こることがある。 +.TP +\fBEISCONN\fP +接続済みのソケットに対して \fBconnect\fP(2) が呼ばれた。 +.TP +\fBEMSGSIZE\fP +データグラムが path MTU よりも大きく、フラグメント化もできない。 +.TP +\fBENOBUFS\fP, \fBENOMEM\fP +空きメモリーが足りない。 このエラーは、メモリーアロケーションがソケットバッファーの 大きさによって制限されていることを意味しているのが通常であるが、 +100% そうだというわけではない。 +.TP +\fBENOENT\fP +パケットが到着していないソケットに対して \fBSIOCGSTAMP\fP が呼ばれた。 +.TP +\fBENOPKG\fP +カーネルサブシステムが設定されていない。 +.TP +\fBENOPROTOOPT\fP と \fBEOPNOTSUPP\fP +無効なソケットオプションが渡された。 +.TP +\fBENOTCONN\fP +接続されていないソケットに対して、 接続状態でしか定義されていない操作を行おうとした。 +.TP +\fBEPERM\fP +高い優先度を設定したり、設定を変更したり、要求されたプロセスや プロセスグループにシグナルを送ったりするのに必要な権限を、 ユーザーが持っていない。 +.TP +\fBEPIPE\fP +接続が接続相手によって、予期しないやり方でクローズまたはシャットダウンされた。 +.TP +\fBESOCKTNOSUPPORT\fP +ソケットが未設定であるか、知らないソケットタイプが要求された。 +.PP +他のエラーが上層のプロトコルによって生じるかもしれない。 \fBtcp\fP(7), \fBraw\fP(7), \fBudp\fP(7), \fBsocket\fP(7) +などを参照のこと。 +.SH 注意 +.\" IP_XFRM_POLICY is Linux-specific +.\" IP_IPSEC_POLICY is a nonstandard extension, also present on some BSDs +\fBIP_FREEBIND\fP, \fBIP_MSFILTER\fP, \fBIP_MTU\fP, \fBIP_MTU_DISCOVER\fP, +\fBIP_RECVORIGDSTADDR\fP, \fBIP_PASSSEC\fP, \fBIP_PKTINFO\fP, \fBIP_RECVERR\fP, +\fBIP_ROUTER_ALERT\fP, \fBIP_TRANSPARENT\fP は Linux 固有である。 +.PP +\fBSO_BROADCAST\fP オプションの利用には、くれぐれも注意すること。 +これは Linux では特権操作ではない。 +不注意なブロードキャストを行うと、ネットワークは簡単に過負荷状態になる。 +新しいアプリケーションプロトコルには、ブロードキャストではなく +マルチキャストグループを用いるほうがよい。 ブロードキャストは推奨されない。 +.PP +他の BSD のソケット実装では、 \fBIP_RCVDSTADDR\fP と \fBIP_RECVIF\fP といったソケットオプションがサポートされており、 +宛先アドレスや受信データグラムのインターフェースが取得できるように なっていることもある。 Linux で同じことをやらせるには、より一般的な +\fBIP_PKTINFO\fP が使える。 +.PP +いくつかの BSD のソケット実装では \fBIP_RECVTTL\fP オプションも提供されているが、タイプ \fBIP_RECVTTL\fP +の補助メッセージは受信パケットとともに渡される。 これは Linux で使われている \fBIP_TTL\fP オプションとは異なる動作である。 +.PP +\fBSOL_IP\fP ソケットオプションレベルは移植性がない。 BSD ベースのプロトコルスタックでは \fBIPPROTO_IP\fP +レベルが使用されている。 +.PP +\fBINADDR_ANY\fP +(0.0.0.0) and +\fBINADDR_BROADCAST\fP +(255.255.255.255) are byte\-order\-neutral. + This means +\fBhtonl\fP(3) +has no effect on them. +.SS 移植性 +Linux 2.0 との互換性のために、 obsolete な \fBsocket(AF_INET, SOCK_PACKET, +\fP\fIprotocol\fP\fB)\fP という書式でも \fBpacket\fP(7) をオープンできるようになっているが、これはお勧めできない。今後は +\fBsocket(AF_PACKET, SOCK_RAW, \fP\fIprotocol\fP\fB)\fP +を代わりに用いるべきである。主な違いは、ジェネリックなリンク層用の \fIsockaddr_ll\fP アドレス構造体が、古い \fBsockaddr_pkt\fP +に変わって用いられるようになったことである。 +.SH バグ +エラーの値がまったく首尾一貫していない。 +.PP +一時ポートの範囲の枯渇を示すのに使われるエラーは、 一時ポートの割り当てを行えるシステムコール (\fBconnect\fP(2), \fBbind\fP(2), +\fBlisten\fP(2), \fBsendto\fP(2)) により異なる。 +.PP +.\" .PP +.\" Some versions of glibc forget to declare +.\" .IR in_pktinfo . +.\" Workaround currently is to copy it into your program from this man page. +IP 固有のインターフェースオプションを指定するための ioctl と ARP テーブルのことが記述されていない。 +.PP +.\" .SH AUTHORS +.\" This man page was written by Andi Kleen. +\fBrecvmsg\fP(2) で \fImsg_name\fP に \fBMSG_ERRQUEUE\fP +を指定して、受信パケットに入っていた宛先アドレスを取得する方法は 2.2 カーネルの一部でうまく動かない。 +.SH 関連項目 +\fBrecvmsg\fP(2), \fBsendmsg\fP(2), \fBbyteorder\fP(3), \fBcapabilities\fP(7), +\fBicmp\fP(7), \fBipv6\fP(7), \fBnetdevice\fP(7), \fBnetlink\fP(7), \fBraw\fP(7), +\fBsocket\fP(7), \fBtcp\fP(7), \fBudp\fP(7), \fBip\fP(8) +.PP +The kernel source file \fIDocumentation/networking/ip\-sysctl.txt\fP. +.PP +RFC\ 791: 元々の IP 仕様。 RFC\ 1122: IPv4 ホストの要件。 RFC\ 1812: IPv4 ルーターの要件。 +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は +\%https://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/manual/LDP_man-pages/draft/man7/ipv6.7 b/manual/LDP_man-pages/draft/man7/ipv6.7 index 56cda46d..264087b8 100644 --- a/manual/LDP_man-pages/draft/man7/ipv6.7 +++ b/manual/LDP_man-pages/draft/man7/ipv6.7 @@ -131,9 +131,8 @@ v4\-mapped\-on\-v6 アドレス型を用いることで、 IPv4 接続も v6 API API をサポートするだけで、 両方のプロトコルをサポートできる。 v4\-mapped\-on\-v6 アドレス型は C ライブラリ内部のアドレスを 扱う関数によって透過的に処理される。 .PP -IPv4 and IPv6 share the local port space. When you get an IPv4 connection -or packet to an IPv6 socket, its source address will be mapped to v6 and it -will be mapped to v6. +IPv4 と IPv6 はローカルポート空間を共有する。 IPv4 の接続 (またはパケット) を IPv6 ソケットが取得すると、 発信元アドレスが +v6 にマップされ、その接続 (パケット) も v6 にマップされる。 .SS アドレスのフォーマット .in +4n .EX @@ -160,10 +159,9 @@ Linux の場合は、これはリンクローカルアドレスでのみサポ この場合 \fIsin6_scope_id\fP にはインターフェースのインデックスが含まれる ことになる (\fBnetdevice\fP(7) を参照)。 .PP -IPv6 supports several address types: unicast to address a single host, -multicast to address a group of hosts, anycast to address the nearest member -of a group of hosts (not implemented in Linux), IPv4\-on\-IPv6 to address an -IPv4 host, and other reserved address types. +IPv6 は何種類かのアドレスタイプをサポートしている。 単一のホストをアドレスするための unicast、 ホストのグループをアドレスするための +multicast、 ホストのグループ中で最も近くにいるものをアドレスするための anycast (これは Linux では実装されていない)、 +IPv4 ホストをアドレスするための IPv4\-on\-IPv6。 他にも予約済みのアドレスタイプがある。 .PP IPv6 でのアドレス表記は 4 桁の 16 進数 8 個からなり、 \(aq:\(aq は区切り文字はで、"::" は 0 ビットの文字列を表す。 特殊なアドレスとして、ループバックを表す ::1、 IPv4\-mapped\-on\-IPv6 を表す ::FFFF::. +.\" +.\" %%%LICENSE_START(VERBATIM_ONE_PARA) +.\" Permission is granted to distribute possibly modified copies +.\" of this page provided the header is included verbatim, +.\" and in case of nontrivial modification author and date +.\" of the modification is added to the header. +.\" %%%LICENSE_END +.\" +.\" $Id: packet.7,v 1.13 2000/08/14 08:03:45 ak Exp $ +.\" +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.\" +.\" Japanese Version Copyright (c) 1999 NAKANO Takeo all rights reserved. +.\" Translated 1999-12-06, NAKANO Takeo +.\" Updated 2001-02-13, Kentaro Shirakata +.\" Updated 2005-02-21, Akihiro MOTOKI +.\" +.TH PACKET 7 2020\-12\-21 Linux "Linux Programmer's Manual" +.SH 名前 +packet \- デバイスレベルのパケットインターフェース +.SH 書式 +.nf +\fB#include \fP +\fB#include \fP +\fB#include /* L2 プロトコル */\fP +.PP +\fBpacket_socket = socket(AF_PACKET, int \fP\fIsocket_type\fP\fB, int \fP\fIprotocol\fP\fB);\fP +.fi +.SH 説明 +packet ソケットは、デバイスドライバ (OSI レイヤ 2) レベルで 生のパケット (raw packet) を送受信するために用いられる。 +packet ソケットを使うと、ユーザー空間で物理層の上に プロトコルモジュールを実装することができる。 +.PP +\fIsocket_type\fP には \fBSOCK_RAW\fP と \fBSOCK_DGRAM\fP のいずれかを指定する。 \fBSOCK_RAW\fP +はリンクレベルヘッダーを含む raw パケットを、 \fBSOCK_DGRAM\fP はリンクレベルヘッダーが削除された加工済みパケットを示す。 +リンクレベルヘッダー情報は \fIsockaddr_ll\fP 構造体で共通のフォーマットで入手できる。 \fIprotocol\fP には IEEE 802.3 +プロトコル番号を ネットワークバイトオーダーで指定する。 指定できるプロトコルのリストは、インクルードファイル +\fI\fP を参照。プロトコルを \fBhtons(ETH_P_ALL)\fP +にすると、全てのプロトコルが受信される。 外部から来たパケットのうち指定したプロトコルのものは、 +カーネルに実装されているプロトコルに渡される前の段階で、 packet ソケットに渡される。 +.PP +In order to create a packet socket, a process must have the \fBCAP_NET_RAW\fP +capability in the user namespace that governs its network namespace. +.PP +\fBSOCK_RAW\fP パケットでは、パケットをデバイスドライバと受け渡しする際、 パケットデータに変更が行われることはない。 +パケットの受信時には、アドレスの解析だけは行われ、 標準的な \fIsockaddr_ll\fP +アドレス構造体に渡される。パケットの送信時には、ユーザーが指定する バッファーに物理層のヘッダーが含まれている必要がある。 +パケットはそのまま修正を受けずに、行き先アドレスから決定される インターフェースのネットワークドライバにキューイングされる。 +デバイスドライバによっては、他のヘッダーを常に追加するものもある。 \fBSOCK_RAW\fP は Linux 2.0 の obosolete な +\fBAF_INET/SOCK_PACKET\fP と似ているが、互換性があるわけではない。 +.PP +\fBSOCK_DGRAM\fP はやや高位のレベルで動作する。物理ヘッダーは、パケットがユーザーに 渡される前に削除される。 \fBSOCK_DGRAM\fP の +packet ソケットを通して送られるパケットは、 \fIsockaddr_ll\fP +の行き先アドレスの情報に基づき、適切な物理層のヘッダーが付加されてから、 キューに送られる。 +.PP +By default, all packets of the specified protocol type are passed to a +packet socket. To get packets only from a specific interface use \fBbind\fP(2) +specifying an address in a \fIstruct sockaddr_ll\fP to bind the packet socket +to an interface. Fields used for binding are \fIsll_family\fP (should be +\fBAF_PACKET\fP), \fIsll_protocol\fP, and \fIsll_ifindex\fP. +.PP +\fBconnect\fP(2) 操作は packet ソケットではサポートされていない。 +.PP +\fBMSG_TRUNC\fP フラグが \fBrecvmsg\fP(2), \fBrecv\fP(2), \fBrecvfrom\fP(2) に渡されると、 +(バッファーサイズより大きかったとしても) 常に実際に通信された パケットの長さが返される。 +.SS アドレスのタイプ +\fIsockaddr_ll\fP 構造体はデバイスに依存しない物理層のアドレスである。 +.PP +.in +4n +.EX +struct sockaddr_ll { + unsigned short sll_family; /* 常に AF_PACKET */ + unsigned short sll_protocol; /* 物理層のプロトコル */ + int sll_ifindex; /* インターフェース番号 */ + unsigned short sll_hatype; /* ARP ハードウェア種別 */ + unsigned char sll_pkttype; /* パケット種別 */ + unsigned char sll_halen; /* アドレスの長さ */ + unsigned char sll_addr[8]; /* 物理層のアドレス */ +}; +.EE +.in +.PP +この構造体のフィールドは以下の通りである。 +.IP * 3 +\fIsll_protocol\fP is the standard ethernet protocol type in network byte order +as defined in the \fI\fP include file. It defaults +to the socket's protocol. +.IP * +\fIsll_ifindex\fP is the interface index of the interface (see +\fBnetdevice\fP(7)); 0 matches any interface (only permitted for binding). +\fIsll_hatype\fP is an ARP type as defined in the \fI\fP +include file. +.IP * +\fIsll_pkttype\fP contains the packet type. Valid types are \fBPACKET_HOST\fP for +a packet addressed to the local host, \fBPACKET_BROADCAST\fP for a +physical\-layer broadcast packet, \fBPACKET_MULTICAST\fP for a packet sent to a +physical\-layer multicast address, \fBPACKET_OTHERHOST\fP for a packet to some +other host that has been caught by a device driver in promiscuous mode, and +\fBPACKET_OUTGOING\fP for a packet originating from the local host that is +looped back to a packet socket. These types make sense only for receiving. +.IP * +\fIsll_addr\fP and \fIsll_halen\fP contain the physical\-layer (e.g., IEEE 802.3) +address and its length. The exact interpretation depends on the device. +.PP +パケットを送る場合は、 \fIsll_family\fP, \fIsll_addr\fP, \fIsll_halen\fP, \fIsll_ifindex\fP, +\fIsll_protocol\fP を指定すれば十分である。 その他のフィールドは 0 にしておくべきである。 \fIsll_hatype\fP と +\fIsll_pkttype\fP には受信したパケットの情報が設定される。 +.SS ソケットオプション +パケットソケットのオプションは、レベル \fBSOL_PACKET\fP を指定して \fBsetsockopt\fP(2) を呼び出すことで設定できる。 +.TP +\fBPACKET_ADD_MEMBERSHIP\fP +.PD 0 +.TP +\fBPACKET_DROP_MEMBERSHIP\fP +.PD +packet ソケットは、物理層のマルチキャストや 無差別モード (promiscuous mode) を設定して使うことができる。 +\fBPACKET_ADD_MEMBERSHIP\fP はバインドを追加し、 \fBPACKET_DROP_MEMBERSHIP\fP +はバインドを削除する。これらはいずれも \fIpacket_mreq\fP 構造体を引き数に取る。 +.IP +.in +4n +.EX +struct packet_mreq { + int mr_ifindex; /* インターフェース番号 */ + unsigned short mr_type; /* 動作 */ + unsigned short mr_alen; /* アドレスの長さ */ + unsigned char mr_address[8]; /* 物理層のアドレス */ +}; +.EE +.in +.IP +\fImr_ifindex\fP は、ステータスを変更したいインターフェースの インターフェース番号である。 \fImr_type\fP +フィールドは実行する動作を指定する: \fBPACKET_MR_PROMISC\fP は、共有している媒体からの全てのパケットを受信できるようにする +(しばしば "無差別モード (promiscuous mode)" と呼ばれる)。 \fBPACKET_MR_MULTICAST\fP は、そのソケットを、 +\fImr_address\fP と \fImr_alen\fP で指定される物理層のマルチキャストブループにバインドする。 +\fBPACKET_MR_ALLMULTI\fP は socket を up にして、そのインターフェースに到達したすべての +マルチキャストパケットを受信できるようにする。 +.IP +昔からある ioctl だけでなく、 \fBSIOCSIFFLAGS\fP, \fBSIOCADDMULTI\fP, \fBSIOCDELMULTI\fP +を同じ目的に用いることができる。 +.TP +\fBPACKET_AUXDATA\fP (Linux 2.6.21 以降) +.\" commit 8dc4194474159660d7f37c495e3fc3f10d0db8cc +ブール値のオプションを有効すると、 パケットソケットは、パケットと一緒にメタデータ構造体を \fBrecvmsg\fP(2) コントロールフィールドで渡す。 +この構造体は \fBcmsg\fP(3) を使って読むことができる。 定義は以下の通りである。 +.IP +.in +4n +.EX +.\" commit a0cdfcf39362410d5ea983f4daf67b38de129408 added tp_vlan_tpid +struct tpacket_auxdata { + __u32 tp_status; + __u32 tp_len; /* packet length */ + __u32 tp_snaplen; /* captured length */ + __u16 tp_mac; + __u16 tp_net; + __u16 tp_vlan_tci; + __u16 tp_vlan_tpid; /* Since Linux 3.14; earlier, these + were unused padding bytes */ +}; +.EE +.in +.TP +\fBPACKET_FANOUT\fP (Linux 3.1 以降) +.\" commit dc99f600698dcac69b8f56dda9a8a00d645c5ffc +スレッドにまたがって処理をスケールさせるため、 パケットソケットはファンアウトグループを構成することができる。 このモードでは、 +マッチしたそれぞれのパケットはグループ内のいずれか一つのソケットにだけキューイングされる。 ソケットをファンアウトグループに参加させるには、 レベル +\fBSOL_PACKET\fP でオプション \fBPACKET_FANOUT\fP を指定して \fBsetsockopt\fP(2) を呼び出す。 +ネットワーク名前空間毎に最大 65536 個の独立したグループを持つことができる。 整数のオプション値の先頭 16 ビットに ID +をエンコードすることで、 ソケットはグループを選択する。 あるグループへの最初のパケットソケットの参加があった時点で、 +グループは暗黙のうちに作成される。 既存のグループへの参加が成功するためには、 それ以降にそのグループに参加しようとするパケットソケットは、 +プロトコロ、 デバイス設定、ファンアウトモード、フラグが同じである必要がある (下記参照)。 パケットソケットがファンアウトグループから抜けるのは、 +そのソケットをクローズした場合だけである。 ファンアウトグループは最後のソケットがクローズした場合に削除される。 +.IP +Fanout supports multiple algorithms to spread traffic between sockets, as +follows: +.RS +.IP * 3 +The default mode, \fBPACKET_FANOUT_HASH\fP, sends packets from the same flow to +the same socket to maintain per\-flow ordering. For each packet, it chooses +a socket by taking the packet flow hash modulo the number of sockets in the +group, where a flow hash is a hash over network\-layer address and optional +transport\-layer port fields. +.IP * +The load\-balance mode \fBPACKET_FANOUT_LB\fP implements a round\-robin +algorithm. +.IP * +\fBPACKET_FANOUT_CPU\fP selects the socket based on the CPU that the packet +arrived on. +.IP * +\fBPACKET_FANOUT_ROLLOVER\fP processes all data on a single socket, moving to +the next when one becomes backlogged. +.IP * +\fBPACKET_FANOUT_RND\fP selects the socket using a pseudo\-random number +generator. +.IP * +.\" commit 2d36097d26b5991d71a2cf4a20c1a158f0f1bfcd +\fBPACKET_FANOUT_QM\fP (available since Linux 3.14) selects the socket using +the recorded queue_mapping of the received skb. +.RE +.IP +ファンアウトモードでは追加のオプションがある。 IP フラグメンテーションが起こると、 +同じフローのパケットのフローハッシュが異なるハッシュを持つことになる。 フラグ \fBPACKET_FANOUT_FLAG_DEFRAG\fP +をセットすると、 パケットはファンアウトを行う前にフラグメント再構築が行われるようになり、 フラグメントがあった場合でも順序が維持される。 +ファンアウトモードとオプションは、 整数のオプション値の下位 16 ビットで指定される。 フラグ +\fBPACKET_FANOUT_FLAG_ROLLOVER\fP を指定すると、 バックアップ戦略としてロールオーバー方式が有効になる。 +元のファンアウトアルゴリズムが backlog ソケットを選択していれば、 パケットは次の利用可能なソケットにロールオーバーされる。 +.TP +\fBPACKET_LOSS\fP (\fBPACKET_TX_RING\fP で使用) +送信リングで不正な形式のパケットに遭遇した場合、 デフォルトではそのリングの \fItp_status\fP を +\fBTP_STATUS_WRONG_FORMAT\fP に戻し、その送信を直ちに中止する。 +不正な形式のパケットにより、そのパケット自身とその以降にキューに入れられたパケットの送信がブロックされる。形式エラーを修正し、関連する +\fItp_status\fP を \fBTP_STATUS_SEND_REQUEST\fP に設定し直し、\fBsend\fP(2) +を使って送信処理を再開しなければならない。 しかしながら、 \fBPACKET_LOSS\fP がセットされている場合、 +不正な形式のパケットはすべてスキップされ、 その送信リングの \fItp_status\fP は \fBTP_STATUS_AVAILABLE\fP +に設定し直され、送信処理は継続される。 +.TP +\fBPACKET_RESERVE\fP (\fBPACKET_RX_RING\fP で使用) +デフォルトでは、パケット受信リングはメタデータ構造体とアライメント用のパディングの直後にパケットを書き込む。 +この整数オプションを設定すると、パケットの前に追加で領域が予約される。 +.TP +\fBPACKET_RX_RING\fP +非同期でのパケット受信用のメモリーマップされたリングバッファーを作成する。 パケットソケットはアプリケーションのアドレス空間に連続する領域を確保し、 +そこにパケットスロットの配列を構成し、 (最大 \fItp_snaplen\fP 個の) パケットを順にスロットにコピーする。 各パケットの前には +\fItpacket_auxdata\fP に似たメタデータ構造体が置かれる。 +プロトコルフィールドには、データの、メタデータヘッダーの先頭からのオフセットが入る。 \fItp_net\fP にはネットワーク層へのオフセットが格納される。 +パケットソケットが \fBSOCK_DGRAM\fP 型の場合、 \fItp_mac\fP も同じである。 \fBSOCK_RAW\fP 型の場合、 \fItp_net\fP +にはリンク層のフレームへのオフセットが入る。 パケットソケットとアプリケーションは \fItp_status\fP フィールドを通してリングの先頭 +(head) と末尾 (tail) の情報を受け渡す。 パケットソケットは \fItp_status\fP が \fBTP_STATUS_KERNEL\fP +のすべてのスロットを所有しており、 スロットにデータが入ると、 +パケットソケットはそのスロットのステータスをアプリケーションに所有権を渡す状態に変更する。 通常の動作では、 新しい \fItp_status\fP +で少なくとも \fBTP_STATUS_USER\fP ビットがセットされていれば、 受信されたパケットが格納されたことを示している。 +アプリケーションがパケットの処理を終えると、アプリケーションはそのスロットの \fBtp_status\fP を \fBTP_STATUS_KERNEL\fP +に設定し、そのスロットの所有権をソケットに返す。 +.IP +パケットソケットは、複数バージョンのパケットリングを実装している。 実装の詳細は Linux カーネルソースツリーの +\fIDocumentation/networking/packet_mmap.txt\fP で説明されている。 +.TP +\fBPACKET_STATISTICS\fP +パケットソケットの統計情報を次の構造体形式で取得する。 +.IP +.in +4n +.EX +struct tpacket_stats { + unsigned int tp_packets; /* 総パケット数 */ + unsigned int tp_drops; /* ドロップパケット数 */ +}; +.EE +.in +.IP +統計情報を取得すると、内部カウンターはリセットされる。 \fBTPACKET_V3\fP のリングを使う場合には、統計情報構造体は違うものになる。 +.TP +\fBPACKET_TIMESTAMP\fP (\fBPACKET_RX_RING\fP で使用; Linux 2.6.36 以降) +.\" commit 614f60fa9d73a9e8fdff3df83381907fea7c5649 +パケット受信リングでは常にタイムスタンプがメタデータヘッダーに格納される。 +デフォルトでは、タイムスタンプはパケットがリングにコピーされた時点で生成されるソフトウェアによるタイムスタンプである。 +この整数オプションによりタイムスタンプの種類を選択できる。 デフォルト以外では、 Linux カーネルソースツリーの +\fIDocumentation/networking/timestamping.rst\fP に説明がある 2 +種類のハードウェアフォーマットがサポートされている。 +.TP +\fBPACKET_TX_RING\fP (Linux 2.6.31 以降) +.\" commit 69e3c75f4d541a6eb151b3ef91f34033cb3ad6e1 +パケット送信用のメモリーマップされたリングバッファーを作成する。 このオプションは \fBPACKET_RX_RING\fP と同様で、同じ引き数を取る。 +アプリケーションは \fItp_status\fP が \fBTP_STATUS_AVAILABLE\fP のスロットにパケットを書き込み、 +\fItp_status\fP を \fBTP_STATUS_SEND_REQUEST\fP に変更することでそのパケットの送信を予約する。 +パケットの送信準備ができたら、アプリケーションは続けて \fBsend\fP(2) 系のシステムコールを呼び出す。 システムコールの引き数 \fIbuf\fP と +\fIlen\fP は無視される。 \fBsendto\fP(2) や \fBsendmsg\fP(2) を使ってアドレスが渡された場合、 +ソケットのデフォルト値ではなくそのアドレスが使用される。 送信に成功すると、ソケットはそのスロットの \fItp_status\fP を +\fBTP_STATUS_AVAILABLE\fP に戻す。 エラーの場合、 \fBPACKET_LOSS\fP がセットされていなければ、 +直ちに送信を中断しエラーを上げる。 +.TP +\fBPACKET_VERSION\fP (\fBPACKET_RX_RING\fP で使用; Linux 2.6.27 以降) +.\" commit bbd6ef87c544d88c30e4b762b1b61ef267a7d279 +デフォルトでは、 \fBPACKET_RX_RING\fP は \fBTPACKET_V1\fP +のパケット受信リングを作成する。別のバージョンのリングを作成するには、そのリングを作成する前に希望するバージョンが使われるようにこの整数オプションを設定すること。 +.TP +\fBPACKET_QDISC_BYPASS\fP (Linux 3.14 以降) +.\" commit d346a3fae3ff1d99f5d0c819bf86edf9094a26a1 +デフォルトでは、パケットはカーネルの qdisc (トラフィック制御) レイヤー経由で渡される。 これは大半のユースケースに合っている。 +ネットワークに対して可能な限りパケットを送信する (例えば pkggen と同様の方法で負荷対象のデバイスを試験する) +のにパケットソケットを使うトラフィック生成アプライアンスでは、この整数オプションを 1 に設定することで qdisc レイヤーを飛ばすことができる。 +qdisc レイヤーでのパケットバッファーが行われなくなるという副作用がある。 これにより、 +ネットワークデバイスの送信キューの使用量が高い場合にパケット廃棄が起きやすくなる。 +.SS ioctl +.\" FIXME Document SIOCGSTAMPNS +\fBSIOCGSTAMP\fP を用いると、最後に受信したパケットのタイムスタンプを得ることができる。 引き数は \fIstruct timeval\fP +型の変数である。 +.PP +さらに、 \fBnetdevice\fP(7) および \fBsocket\fP(7) で定義されている標準の ioctl はいずれも packet +ソケットに指定可能である。 +.SS エラー処理 +packet ソケットは、パケットをデバイスドライバに渡すときに 起きたエラーしか処理しない。遅延エラー (pending error) +に関する概念は持っていない。 +.SH エラー +.TP +\fBEADDRNOTAVAIL\fP +不明なマルチキャストグループアドレスが渡された。 +.TP +\fBEFAULT\fP +ユーザーが渡したメモリーアドレスが不正。 +.TP +\fBEINVAL\fP +引き数が不正。 +.TP +\fBEMSGSIZE\fP +パケットがインターフェースの MTU より大きい。 +.TP +\fBENETDOWN\fP +インターフェースが up でない。 +.TP +\fBENOBUFS\fP +パケットに割り当てるメモリーが足りない。 +.TP +\fBENODEV\fP +デバイス名が不明。あるいはインターフェースアドレスで指定された インターフェースインデックスが不明。 +.TP +\fBENOENT\fP +パケットを一つも受信していない。 +.TP +\fBENOTCONN\fP +インターフェースアドレスが渡されなかった。 +.TP +\fBENXIO\fP +インターフェースアドレスに不正なインターフェースインデックスが含まれている。 +.TP +\fBEPERM\fP +この操作を行うのに必要な権限をユーザーが持っていない。 +.PP +上記以外のエラーが、低レベルのドライバで生成されることがある。 +.SH バージョン +\fBAF_PACKET\fP は Linux 2.2 の新機能である。これより古いバージョンの Linux では \fBSOCK_PACKET\fP +のみをサポートしていた。 +.PP +.SH 注意 +移植性の必要なプログラムでは、 \fBpcap\fP(3) 経由で \fBAF_PACKET\fP を用いることをお薦めする。ただし、この方法では +\fBAF_PACKET\fP の機能すべてを利用することはできない。 +.PP +\fBSOCK_DGRAM\fP packet ソケットは、IEEE 802.3 フレームの IEEE 802.2 LLC ヘッダーの +生成や解析を行おうとしない。 \fBETH_P_802_3\fP が送信プロトコルに指定されると、カーネルは 802.3 フレームを 生成して length +フィールドに書き込む。 完全に準拠したパケットを得るためにはユーザーが LLC ヘッダーを 与える必要がある。到着した 802.3 パケットでは、 +DSAP/SSAP protocol の各フィールドは多重化 (multiplex) されていない。 代わりにこれらは LLC ヘッダーが前置された +\fBETH_P_802_2\fP プロトコルとして与えられる。したがって、 \fBETH_P_802_3\fP にバインドすることはできない。かわりに +\fBETH_P_802_2\fP にバインドし、自分自身でプロトコルの多重化を行うこと。 送信のデフォルトは、プロトコルフィールドを持つ 標準の +Ethernet DIX encapsulation である。 +.PP +packet ソケットは入出力の firewall chain に影響をうけない。 +.SS 移植性 +In Linux 2.0, the only way to get a packet socket was with the call: +.PP + socket(AF_INET, SOCK_PACKET, protocol) +.PP +This is still supported, but deprecated and strongly discouraged. The main +difference between the two methods is that \fBSOCK_PACKET\fP uses the old +\fIstruct sockaddr_pkt\fP to specify an interface, which doesn't provide +physical\-layer independence. +.PP +.in +4n +.EX +struct sockaddr_pkt { + unsigned short spkt_family; + unsigned char spkt_device[14]; + unsigned short spkt_protocol; +}; +.EE +.in +.PP +\fIspkt_family\fP はデバイスのタイプ、 \fIspkt_protocol\fP は \fI\fP +で定義されている IEEE 802.3 プロトコルタイプ、 \fIspkt_device\fP はデバイスの名前をヌル終端された文字列で与えたもの (例: +eth0) である。 +.PP +この構造体は obsolete であり、 新しくコードを書く時には用いるべきでない。 +.SH バグ +IEEE 802.2/803.3 の LLC の扱い方は、バグと考えても良いだろう。 +.PP +ソケットフィルターについて記載されていない。 +.PP +.\" .SH CREDITS +.\" This man page was written by Andi Kleen with help from Matthew Wilcox. +.\" AF_PACKET in Linux 2.2 was implemented +.\" by Alexey Kuznetsov, based on code by Alan Cox and others. +\fBMSG_TRUNC\fP \fBrecvmsg\fP(2) 拡張は非常にまずい対処であり、制御メッセージで置き換えるべきである。 今のところ +\fBSOCK_DGRAM\fP 経由でパケットについていた宛先アドレスを得る方法がない。 +.SH 関連項目 +\fBsocket\fP(2), \fBpcap\fP(3), \fBcapabilities\fP(7), \fBip\fP(7), \fBraw\fP(7), +\fBsocket\fP(7) +.PP +標準 IP Ethernet encapsulation に関しては RFC\ 894 を、 IEEE 802.3 IP encapsulation +に関しては RFC\ 1700 を参照。 +.PP +物理層のプロトコルに関する記述は \fI\fP インクルードファイルにある。 +.PP +Linux カーネルのソースツリー。 \fIDocumentation/networking/filter.rst\fP には Berkeley Packet +Filters をパケットソケットにどのように適用するかの説明がある。 +\fI/tools/testing/selftests/net/psock_tpacket.c\fP には、 \fBPACKET_RX_RING\fP と +\fBPACKET_TX_RING\fP の利用可能なすべてのバージョンのサンプルソースコードがある。 +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は +\%https://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/manual/LDP_man-pages/draft/man7/raw.7 b/manual/LDP_man-pages/draft/man7/raw.7 index ad89203f..5e35666c 100644 --- a/manual/LDP_man-pages/draft/man7/raw.7 +++ b/manual/LDP_man-pages/draft/man7/raw.7 @@ -33,10 +33,9 @@ raw \- Linux の IPv4 raw ソケット raw ソケットを使うと、新しい IPv4 プロトコルをユーザー空間で 実装できるようになる。 raw ソケットは、リンクレベルヘッダーを 含まない raw データグラムの送受信ができる。 .PP -The IPv4 layer generates an IP header when sending a packet unless the -\fBIP_HDRINCL\fP socket option is enabled on the socket. When it is enabled, -the packet must contain an IP header. For receiving, the IP header is -always included in the packet. +IPv4 レイヤは、扱っているソケットで \fBIP_HDRINCL\fP ソケットオプションが有効になっていなければ、 パケットを送信するときに IP +ヘッダーを生成する。 \fBIP_HDRINCL\fP オプションが有効になっているときは、パケットには IP ヘッダーが含まれていなければならない。 +受信時には、 IP ヘッダーは常にパケットに含まれている。 .PP In order to create a raw socket, a process must have the \fBCAP_NET_RAW\fP capability in the user namespace that governs its network namespace. @@ -57,10 +56,10 @@ tab(:) allbox; c s l l. IP ヘッダーフィールド。 \fBIP_HDRINCL\fP によって送信時に変更される。 -IP チェックサム:Always filled in -ソースアドレス:Filled in when zero -Packet ID:Filled in when zero -全体の長さ:Always filled in +IP チェックサム:常に変更される +ソースアドレス:元の値が 0 の時に変更される +パケット ID:元の値が 0 の時に変更される +全体の長さ:常に変更される .TE .RE .PP @@ -73,9 +72,8 @@ Packet ID:Filled in when zero \fBIP_HDRINCL\fP がセットされていなければ、 raw ソケットの IP ヘッダーオプションを \fBsetsockopt\fP(2) を用いて設定することができる。詳細な情報は \fBip\fP(7) を見よ。 .PP -Starting with Linux 2.2, all IP header fields and options can be set using -IP socket options. This means raw sockets are usually needed only for new -protocols or protocols with no user interface (like ICMP). +Linux 2.2 以降では、 IP ヘッダーの全てのフィールドとオプションとを IP ソケットオプションによって設定できる。したがって raw +ソケットが必要になるのは、新しいプロトコルを設計する場合か、 ユーザーインターフェースを持たないプロトコル (ICMP など) を扱う場合に 限られる。 .PP パケットは、受信されるとまずプロトコルにバインドしている raw ソケットに渡され、 その後で他のプロトコルハンドラー (カーネルのプロトコルモジュールなど) に渡される。 @@ -114,9 +112,8 @@ raw ソケットのオプションは、 \fBIPPROTO_RAW\fP ファミリーフラ 引き数が不正。 .TP \fBEMSGSIZE\fP -Packet too big. Either Path MTU Discovery is enabled (the -\fBIP_MTU_DISCOVER\fP socket flag) or the packet size exceeds the maximum -allowed IPv4 packet size of 64\ kB. +パケットが大きすぎる。 Path MTU Discoverry が有効になっている (\fBIP_MTU_DISCOVER\fP ソケットフラグ) +か、パケットのサイズが IPv4 で許されている パケットサイズの最大値 64\ KB を越えている。 .TP \fBEOPNOTSUPP\fP ソケット呼び出しに不正なフラグ (\fBMSG_OOB\fP など) が渡された。 @@ -131,9 +128,8 @@ allowed IPv4 packet size of 64\ kB. \fBIP_RECVERR\fP と \fBICMP_FILTER\fP は Linux 2.2 で登場した。これらは Linux での拡張であり、 移植性の必要なプログラムでは用いるべきでない。 .PP -Linux 2.0 enabled some bug\-to\-bug compatibility with BSD in the raw socket -code when the \fBSO_BSDCOMPAT\fP socket option was set; since Linux 2.2, this -option no longer has that effect. +Linux 2.0 では \fBSO_BSDCOMPAT\fP ソケットオプションをセットすると、 BSD の raw +ソケットにあるバグに互換性を取ることができた \(em Linux 2.2 以降では、このオプションはもはや効力を持たない。 .SH 注意 デフォルトでは、raw ソケットは Path MTU Discovery を行う。 つまり、カーネルは特定の宛先 IP アドレスの MTU (Maximum Transmission Unit; 最大転送単位) を記録し、raw パケットの書き込みが MTU を超えた場合 @@ -143,10 +139,9 @@ MTU Discovery を無効にすることもできる (詳細は \fBip\fP(7) を を無効にした場合は、パケットサイズが インターフェースの MTU よりも大きいと raw ソケットはそのパケットを フラグメント化して送出する。 しかしながら、性能と信頼性の理由から Path MTU Discovery を 無効にするのは推奨できない。 .PP -A raw socket can be bound to a specific local address using the \fBbind\fP(2) -call. If it isn't bound, all packets with the specified IP protocol are -received. In addition, a raw socket can be bound to a specific network -device using \fBSO_BINDTODEVICE\fP; see \fBsocket\fP(7). +\fBbind\fP(2) システムコールを用いると、 raw ソケットを 特定のローカルアドレスにバインドさせることができる。 +このバインドがされていない場合は、指定した IP プロトコルの すべてのパケットが受信される。 さらに、 \fBSO_BINDTODEVICE\fP +を用いれば raw ソケットを特定のネットワークデバイスに バインドさせることもできる。 \fBsocket\fP(7) を見よ。 .PP \fBIPPROTO_RAW\fP ソケットは送信専用である。もしどうしてもすべての IP パケットを 受信したい場合は、 \fBpacket\fP(7) ソケットを \fBETH_P_IP\fP プロトコルで用いること。 packet ソケットは raw ソケットのように IP @@ -163,8 +158,7 @@ BSD におけるソケットの実装ではこの点において制限がある Linux はユーザーから渡されたヘッダーを決して変更しない (ただし \fBIP_HDRINCL\fP の説明にあるように、 0 をいくつか埋める場合を除く)。 これは他の多くの raw ソケットの実装では異なる。 .PP -Raw sockets are generally rather unportable and should be avoided in -programs intended to be portable. +一般に raw ソケットは移植性がないことが多いので、 移植性が必要なプログラムでは避けるべきである。 .PP raw ソケットへの送信では、 IP プロトコルを \fIsin_port\fP から取得できなければならない。この機能は Linux 2.2 では使えなくなった。 \fBIP_HDRINCL\fP を用いれば同様のことが実現できる。 diff --git a/manual/LDP_man-pages/draft/man7/tcp.7 b/manual/LDP_man-pages/draft/man7/tcp.7 index 9513f2c5..09783f87 100644 --- a/manual/LDP_man-pages/draft/man7/tcp.7 +++ b/manual/LDP_man-pages/draft/man7/tcp.7 @@ -139,15 +139,13 @@ TCP 接続を生成するには、 \fBconnect\fP(2) を用いてもう一方の データのやりとりが可能となる。接続待ち受け状態の (listening) ソケットや、 接続 (connect) されていないソケットを通してデータをやりとりすることはできない。 .PP -Linux supports RFC\ 1323 TCP high performance extensions. These include -Protection Against Wrapped Sequence Numbers (PAWS), Window Scaling and -Timestamps. Window scaling allows the use of large (> 64\ kB) TCP -windows in order to support links with high latency or bandwidth. To make -use of them, the send and receive buffer sizes must be increased. They can -be set globally with the \fI/proc/sys/net/ipv4/tcp_wmem\fP and -\fI/proc/sys/net/ipv4/tcp_rmem\fP files, or on individual sockets by using the -\fBSO_SNDBUF\fP and \fBSO_RCVBUF\fP socket options with the \fBsetsockopt\fP(2) -call. +Linux は RFC\ 1323 の TCP high performance 拡張をサポートしている。 これには、Protection +Against Wrapped Sequence Numbers (PAWS)、 ウィンドウスケーリング、タイムスタンプなどが含まれている。 +ウィンドウスケーリングを利用すると、遅延または帯域の大きな接続で、 (64\ K 以上の) 巨大な TCP ウィンドウを用いることが可能となる。 +これを用いるには、送受信のバッファーサイズを大きくしなければならない。 システム全体に対するバッファーサイズの変更は、ファイル +\fI/proc/sys/net/ipv4/tcp_wmem\fP と \fI/proc/sys/net/ipv4/tcp_rmem\fP +を用いて行うことができる。 また、個々のソケットのみを大きくしたい場合には、 \fBSO_SNDBUF\fP や \fBSO_RCVBUF\fP +ソケットオプションを用いて \fBsetsockopt\fP(2) コールを用いて設定すればよい。 .PP \fBSO_SNDBUF\fP や \fBSO_RCVBUF\fP のメカニズムで宣言されるソケットバッファーの最大サイズは、ファイル \fI/proc/sys/net/core/rmem_max\fP や \fI/proc/sys/net/core/wmem_max\fP @@ -158,17 +156,14 @@ call. ウィンドウよりも大きな値となる。 各接続におけるソケットのバッファーサイズ変更を有効にするには、 \fBlisten\fP(2) や \fBconnect\fP(2) コールの前に設定しなければならない。 より詳しい情報は \fBsocket\fP(7) を見よ。 .PP -TCP supports urgent data. Urgent data is used to signal the receiver that -some important message is part of the data stream and that it should be -processed as soon as possible. To send urgent data specify the \fBMSG_OOB\fP -option to \fBsend\fP(2). When urgent data is received, the kernel sends a -\fBSIGURG\fP signal to the process or process group that has been set as the -socket "owner" using the \fBSIOCSPGRP\fP or \fBFIOSETOWN\fP ioctls (or the -POSIX.1\-specified \fBfcntl\fP(2) \fBF_SETOWN\fP operation). When the -\fBSO_OOBINLINE\fP socket option is enabled, urgent data is put into the normal -data stream (a program can test for its location using the \fBSIOCATMARK\fP -ioctl described below), otherwise it can be received only when the -\fBMSG_OOB\fP flag is set for \fBrecv\fP(2) or \fBrecvmsg\fP(2). +TCP は緊急データ (urgent data) をサポートしている。緊急データは 何らかの重要なメッセージがデータストリームに含まれていること、 +そのデータをできるだけ早く処理すべきこと、を受信者に伝えるために用いられる。 緊急データを送るには、 \fBsend\fP(2) に \fBMSG_OOB\fP +オプションを指定する。 緊急データを受信すると、カーネルは \fBSIGURG\fP シグナルを送信する。送信先は \fBSIOCSPGRP\fP や +\fBFIOSETOWN\fP ioctl (や POSIX.1 で規定されている \fBfcntl\fP(2) \fBF_SETOWN\fP 操作) +を用いてそのソケットの「所有者」として設定された プロセスかプロセスグループである。 \fBSO_OOBINLINE\fP +ソケットオプションが有効になっていると、緊急データは 通常のデータストリームの中に混ぜて送られる (プログラムは下記の \fBSIOCATMARK\fP +ioctl を使って緊急データの場所を調べることができる)。 無効になっている場合には、 \fBrecv\fP(2) や \fBrecvmsg\fP(2) で +\fBMSG_OOB\fP フラグがセットされているときにのみ、緊急データを受信できる。 .PP When out\-of\-band data is present, \fBselect\fP(2) indicates the file descriptor as having an exceptional condition and \fIpoll (2)\fP indicates a @@ -186,7 +181,7 @@ TCP は IP の上層に構築されている (\fBip\fP(7) を参照)。 \fBip\f \fIBoolean\fP は整数値で、 0 以外の値 ("true") は対応するオプションが有効、 0 値 ("false") は無効、であることを意味する。 .TP -\fItcp_abc\fP (Integer; default: 0; Linux 2.6.15 to Linux 3.8) +\fItcp_abc\fP (Integer; default: 0; Linux 2.6.15 から 3.8 まで) .\" Since 2.6.15; removed in 3.9 .\" commit ca2eb5679f8ddffff60156af42595df44a315ef0 .\" The following is from 2.6.28-rc4: Documentation/networking/ip-sysctl.txt @@ -288,9 +283,9 @@ BIC TCP が輻輳ウィンドウの変化により速く反応するようにす .\" Since 2.4.0-test7 RFC\ 2883 の TCP Duplicate SACK のサポートを有効にする。 .TP -\fItcp_ecn\fP (Integer; default: see below; since Linux 2.4) +\fItcp_ecn\fP (integer; default: see below; Linux 2.4 以降) .\" Since 2.4.0-test7 -Enable RFC\ 3168 Explicit Congestion Notification. +RFC\ 3168 Explicit Congestion Notification を有効にする。 .IP このファイルは以下のいずれかの値を取ることができる。 .RS @@ -313,7 +308,7 @@ dropped. However, to facilitate and encourage deployment with option 1, and to work around such buggy equipment, the \fBtcp_ecn_fallback\fP option has been introduced. .TP -\fItcp_ecn_fallback\fP (Boolean; default: enabled; since Linux 4.1) +\fItcp_ecn_fallback\fP (ブール値; デフォルト: 有効; Linux 4.1 以降) .\" commit 492135557dc090a1abb2cfbe1a412757e3ed68ab Enable RFC\ 3168, Section 6.1.1.1. fallback. When enabled, outgoing ECN\-setup SYNs that time out within the normal SYN retransmission timeout @@ -330,7 +325,7 @@ TCP Forward Acknowledgement のサポートを有効にする。 ソケットを強制的にクローズする前に、 最後の FIN パケットを待つ時間を秒単位で指定する。 これは厳密には TCP の仕様を満たしていないが、 DoS 攻撃 (denial of service attack) から身を守るために必要である。 Linux 2.2 ではデフォルト値は 180 であった。 .TP -\fItcp_frto\fP (integer; default: see below; since Linux 2.4.21/2.6) +\fItcp_frto\fP (integer; default: 下記参照; Linux 2.4.21/2.6 以降) .\" Since 2.4.21/2.5.43 F\-RTO を有効にする。F\-RTO は TCP 再送タイムアウト (RTO) からの 復旧性能を向上させたアルゴリズムである。 この機能は無線環境で特に効果を発揮する。 無線環境では、通常は、中間ルーターの輻輳ではなくランダムな無線の干渉 によりパケットロスが発生する。 詳細は @@ -353,10 +348,8 @@ value is the default since Linux 2.6.24. Linu 2.6.22 より前では、このパラメーターはブール値であり、 上記の 0 と 1 のみをサポートしていた。 .TP \fItcp_frto_response\fP (integer; default: 0; Linux 2.6.22 以降) -When F\-RTO has detected that a TCP retransmission timeout was spurious -(i.e., the timeout would have been avoided had TCP set a longer -retransmission timeout), TCP has several options concerning what to do -next. Possible values are: +F\-RTO が TCP 再送タイムアウトが偽物だと検出した場合 (つまり、TCP がもっと長い再送タイムアウトを設定していれば +タイムアウトが避けられた場合)、 次にどうするかに関して選択肢がいくつかある。 以下の値を選択できる。 .RS .IP 0 3 レートを元の半分にする。 滑らかで、保守的な反応を行い、RTT 1回分の時間後に 輻輳ウィンドウ (\fIcwnd\fP) とスロースタートの閾値 @@ -398,15 +391,11 @@ this file still exists, but its value is ignored. .TP \fItcp_max_orphans\fP (integer; default: see below; Linux 2.4 以降) .\" Since 2.3.41 -The maximum number of orphaned (not attached to any user file handle) TCP -sockets allowed in the system. When this number is exceeded, the orphaned -connection is reset and a warning is printed. This limit exists only to -prevent simple denial\-of\-service attacks. Lowering this limit is not -recommended. Network conditions might require you to increase the number of -orphans allowed, but note that each orphan can eat up to \(ti64\ kB of -unswappable memory. The default initial value is set equal to the kernel -parameter NR_FILE. This initial default is adjusted depending on the memory -in the system. +システムが許容する、 orphan な (どのユーザーファイルハンドルにもアタッチされていない) TCP ソケットの最大数。 +この数を越えると、orphan な接続はリセットされ、警告が表示される。 この制限が存在するのは、単純な使用不能 (denial\-of\-service) +攻撃を 防ぐために過ぎない。この値を小さくすることは推奨しない。 ネットワークの条件によっては、この数値を大きくしないといけないかもしれないが、 +orphan なソケットひとつあたり 64\ K 程度のスワップ不可能なメモリーを消費することも注意せよ。 デフォルトの初期値はカーネルパラメーターの +NR_FILE と等しい。 この初期デフォルト値はシステムのメモリーに応じて調整される。 .TP \fItcp_max_syn_backlog\fP (integer; default: 下記参照; Linux 2.2 以降) .\" Since 2.1.53 @@ -515,12 +504,9 @@ TCP の動作を RFC\ 1337 に準拠させる。 無効にすると、TIME_WAIT .RS .TP \fImin\fP -minimum size of the receive buffer used by each TCP socket. The default -value is the system page size. (On Linux 2.4, the default value is 4\ kB, -lowered to \fBPAGE_SIZE\fP bytes in low\-memory systems.) This value is used to -ensure that in memory pressure mode, allocations below this size will still -succeed. This is not used to bound the size of the receive buffer declared -using \fBSO_RCVBUF\fP on a socket. +各 TCP ソケットが用いる受信バッファーの最小サイズ。 デフォルト値はシステムのページサイズである (Linux 2.4 では、デフォルト値は 4\ K バイトで、 メモリーの少ないシステムでは \fBPAGE_SIZE\fP バイトに減らされる)。 この値は、メモリー圧迫モードにおいても、 +このサイズの割り当てが成功することを保証するために用いられる。 これは、 \fBSO_RCVBUF\fP +を用いてソケットの最低受信バッファーサイズを宣言する際には用いられない。 .TP \fIdefault\fP TCP ソケットの受信バッファーのデフォルトサイズ。 この値は、すべてのプロトコルに対して定義されている、 @@ -556,7 +542,7 @@ RFC\ 2018 の TCP Selective Acknowledgements を有効にする。 この解釈に従うと、緊急ポインターは緊急データの最後のバイトを指す。 このオプションを無効にすると、緊急ポインターの解釈が BSD 互換の方法で 行われる: 緊急ポインターは緊急データの後の最初のバイトを指す。 このオプションを有効にすると、相互運用性に問題が生じるかもしれない。 .TP -\fItcp_syn_retries\fP (integer; default: 6; since Linux 2.2) +\fItcp_syn_retries\fP (integer; default: 6; Linux 2.2 以降) .\" Since 2.1.38 .\" commit 6c9ff979d1921e9fd05d89e1383121c2503759b9 The maximum number of times initial SYNs for an active TCP connection @@ -570,7 +556,7 @@ corresponded to approximately 180 seconds. .\" Since 2.1.38 passive な TCP 接続の SYN/ACK セグメントで再送を試みる最大数。 この数値は 255 よりも大きくすべきではない。 .TP -\fItcp_syncookies\fP (integer; default: 1; since Linux 2.2) +\fItcp_syncookies\fP (integer; default: 1; Linux 2.2 以降) .\" Since 2.1.43 Enable TCP syncookies. The kernel must be compiled with \fBCONFIG_SYN_COOKIES\fP. The syncookies feature attempts to protect a socket @@ -592,13 +578,13 @@ Send out syncookies when the syn backlog queue of a socket overflows. for network testing. .RE .TP -\fItcp_timestamps\fP (integer; default: 1; since Linux 2.2) +\fItcp_timestamps\fP (integer; default: 1; Linux 2.2 以降) .\" Since 2.1.36 Set to one of the following values to enable or disable RFC\ 1323 TCP timestamps: .RS .IP 0 3 -Disable timestamps. +timestamps を有効にする。 .IP 1 Enable timestamps as defined in RFC1323 and use random offset for each connection rather than only using the current time. @@ -612,7 +598,7 @@ to this value is meaningful since Linux 4.10. このパラメーターは、一つの TCP Segmentation Offload (TSO) フレームで 消費できる輻輳ウィンドウの割合 (パーセント) を制御する。 バースト性と、どれだけ大きな TSO フレームを構築するかのはトレードオフであり、 このパラメーターはその度合いを設定する。 .TP -\fItcp_tw_recycle\fP (Boolean; default: disabled; Linux 2.4 to 4.11) +\fItcp_tw_recycle\fP (ブール値; デフォルト: 無効; Linux 2.4 以降 4.11 まで) .\" Since 2.3.15 .\" removed in 4.12; commit 4396e46187ca5070219b81773c4e65088dac50cc .\" @@ -646,13 +632,11 @@ start の閾値と輻輳ウィンドウを設定する。 TCP Westwood+ は、 .TP \fItcp_window_scaling\fP (ブール値; デフォルト: 有効; Linux 2.2 以降) .\" Since 2.1.36 -Enable RFC\ 1323 TCP window scaling. This feature allows the use of a large -window (> 64\ kB) on a TCP connection, should the other end support it. -Normally, the 16 bit window length field in the TCP header limits the window -size to less than 64\ kB. If larger windows are desired, applications can -increase the size of their socket buffers and the window scaling option will -be employed. If \fItcp_window_scaling\fP is disabled, TCP will not negotiate -the use of window scaling with the other end during connection setup. +RFC\ 1323 の TCP ウィンドウスケーリングを有効にする。 この機能を用いると、接続先が対応していれば、 TCP 接続で大きな (64\ K +以上の) ウィンドウが使えるようになる。 通常は TCP ヘッダーのウインドウ長フィールドは 16 ビットなので、 ウィンドウサイズは 64\ K +バイト以下に限られる。 もっと大きなウィンドウを使いたい場合は、 アプリケーションはソケットバッファーのサイズを増やして、 +ウィンドウスケーリングのオプションを利用すればよい。 \fItcp_window_scaling\fP を無効にしていると、 TCP +は他端との接続設定の際に、 ウィンドウスケーリングのネゴシエーションを行なわない。 .TP \fItcp_wmem\fP (Linux 2.4 以降) .\" Since 2.4.0-test7 @@ -662,21 +646,16 @@ the use of window scaling with the other end during connection setup. .RS .TP \fImin\fP -Minimum size of the send buffer used by each TCP socket. The default value -is the system page size. (On Linux 2.4, the default value is 4\ kB.) This -value is used to ensure that in memory pressure mode, allocations below this -size will still succeed. This is not used to bound the size of the send -buffer declared using \fBSO_SNDBUF\fP on a socket. +各 TCP ソケットが用いる送信バッファーの最小サイズ。 デフォルト値はシステムのページサイズである (Linux 2.4 では、デフォルト値は 4\ K である)。 この値は、メモリー圧迫モードにおいても、 このサイズ以下の割り当てが成功することを保証するために用いられる。 これは、 +\fBSO_SNDBUF\fP を用いてソケットの最低送信バッファーサイズを宣言する際には用いられない。 .TP \fIdefault\fP .\" True in Linux 2.4 and 2.6 -The default size of the send buffer for a TCP socket. This value overwrites -the initial default buffer size from the generic global -\fI/proc/sys/net/core/wmem_default\fP defined for all protocols. The default -value is 16\ kB. If larger send buffer sizes are desired, this value should -be increased (to affect all sockets). To employ large TCP windows, the -\fI/proc/sys/net/ipv4/tcp_window_scaling\fP must be set to a nonzero value -(default). +TCP ソケットの送信バッファーのデフォルトサイズ。 この値は、すべてのプロトコルに対して定義されている、 +ジェネリックなグローバルのデフォルトバッファーサイズ \fI/proc/sys/net/core/wmem_default\fP より優先される。 +デフォルト値は 16\ K バイトである。 大きな送信バッファーサイズが必要な場合は、 この値を増やすべきである (すべてのソケットに影響する)。 +大きな TCP ウィンドウを用いるには、 \fI/proc/sys/net/ipv4/tcp_window_scaling\fP を 0 以外の値 +(デフォルト値) にしておかなければならない。 .TP \fImax\fP 各 TCP ソケットで用いる送信バッファーの最大サイズ。 この値よりも \fI/proc/sys/net/core/wmem_max\fP が優先される。 @@ -684,8 +663,7 @@ be increased (to affect all sockets). To employ large TCP windows, the .IP max(65536, min(4\ MB, \fItcp_mem\fP[1]*PAGE_SIZE/128)) .IP -(On Linux 2.4, the default value is 128\ kB, lowered 64\ kB depending on -low\-memory systems.) +(Linux 2.4 では、デフォルト値は 128\ K バイトで、 メモリーの少ないシステムでは 64\ K にまで減らされる。) .RE .TP \fItcp_workaround_signed_windows\fP (ブール値; デフォルト: 無効; Linux 2.6.26 以降) @@ -782,11 +760,9 @@ quickack モードでは ack はすぐに送信される。 このフラグは .\" The following text taken nearly verbatim from Jerry Chu's (excellent) .\" commit message. .\" -This option takes an \fIunsigned int\fP as an argument. When the value is -greater than 0, it specifies the maximum amount of time in milliseconds that -transmitted data may remain unacknowledged before TCP will forcibly close -the corresponding connection and return \fBETIMEDOUT\fP to the application. If -the option value is specified as 0, TCP will use the system default. +このオプションは \fIunsigned int\fP 型の引き数を取る。 値が 0 より大きい場合、その値は、 どのくらいの時間、送信されたデータが ACK +を受信しないままの状態が続くと、 TCP がその接続を強制的にクローズし、アプリケーションに \fBETIMEDOUT\fP を返すかを、 +ミリ秒単位で指定する。 オプションの値が 0 の場合、TCP はシステムのデフォルト値を使用する。 .IP ユーザータイムアウトを長くすると、 通信の両端での接続性がない場合でも長い時間 TCP 接続が維持されるようになる。 ユーザータイムアウトを短くすると、 アプリケーションは必要であれば「早く失敗」できるようになる。 設定しなかった場合は、 通常の WAN 環境では現在のシステムのデフォルトの 20 diff --git a/manual/LDP_man-pages/draft/man7/udp.7 b/manual/LDP_man-pages/draft/man7/udp.7 index aaa6912e..a9994a2e 100644 --- a/manual/LDP_man-pages/draft/man7/udp.7 +++ b/manual/LDP_man-pages/draft/man7/udp.7 @@ -145,8 +145,7 @@ other socket options that are also applicable for UDP sockets, see を使う方が安全である。 .TP \fBTIOCOUTQ\fP (\fBSIOCOUTQ\fP) -Returns the number of data bytes in the local send queue. Supported only -with Linux 2.4 and above. +ローカル送信キューにあるデータサイズをバイト単位で返す。 Linux 2.4 以上でのみ対応している。 .PP さらに、 \fBip\fP(7) と \fBsocket\fP(7) で述べられている全ての ioctl も対応している。 .SH エラー diff --git a/manual/LDP_man-pages/draft/man7/udplite.7 b/manual/LDP_man-pages/draft/man7/udplite.7 index 860dc920..54ffb594 100644 --- a/manual/LDP_man-pages/draft/man7/udplite.7 +++ b/manual/LDP_man-pages/draft/man7/udplite.7 @@ -53,9 +53,8 @@ UDP\-Lite は UDP (RFC\ 768) の拡張で、可変長のチェックサムをサ このプロトコルが効果を発揮するのは、少しだけ壊れたデータグラムがあった場合に、 そのデータグラムを下位レイヤーのプロトコルに廃棄させるのではなく、 それを利用することができるような、ある種のマルチメディア転送においてである。 .PP -The variable\-length checksum coverage is set via a \fBsetsockopt\fP(2) -option. If this option is not set, the only difference from UDP is in using -a different IP protocol identifier (IANA number 136). +可変長のチェックサムの対象範囲は \fBsetsockopt\fP(2) オプション経由で設定される。 このオプションが設定されていない場合、UDP +と異なるのは 違う IP プロトコル識別子 (IANA 番号 136) を使用する点だけである。 .PP UDP\-Lite の実装は \fBudp\fP(7) の完全な拡張、すなわち API と API の動作は同じである。 これに加えて、2 つのソケットオプションがチェックサムの対象範囲を 制御するために提供されている。 @@ -101,10 +100,10 @@ IPv6 の jumbograms (巨大なデータグラム; RFC\ 2675) の場合には、 .SH ファイル .TP \fI/proc/net/snmp\fP -Basic UDP\-Litev4 statistics counters. +UDP\-Litev4 の基本的な統計情報カウンター。 .TP \fI/proc/net/snmp6\fP -Basic UDP\-Litev6 statistics counters. +UDP\-Litev6 の基本的な統計情報カウンター。 .SH バージョン UDP\-Litev4/v6 は Linux 2.6.20 で初めて登場した。 .SH バグ diff --git a/manual/LDP_man-pages/draft/man7/unix.7 b/manual/LDP_man-pages/draft/man7/unix.7 new file mode 100644 index 00000000..4106e0ad --- /dev/null +++ b/manual/LDP_man-pages/draft/man7/unix.7 @@ -0,0 +1,835 @@ +.\" This man page is Copyright (C) 1999 Andi Kleen , +.\" Copyright (C) 2008-2014, Michael Kerrisk , +.\" and Copyright (C) 2016, Heinrich Schuchardt +.\" +.\" %%%LICENSE_START(VERBATIM_ONE_PARA) +.\" Permission is granted to distribute possibly modified copies +.\" of this page provided the header is included verbatim, +.\" and in case of nontrivial modification author and date +.\" of the modification is added to the header. +.\" %%%LICENSE_END +.\" +.\" Modified, 2003-12-02, Michael Kerrisk, +.\" Modified, 2003-09-23, Adam Langley +.\" Modified, 2004-05-27, Michael Kerrisk, +.\" Added SOCK_SEQPACKET +.\" 2008-05-27, mtk, Provide a clear description of the three types of +.\" address that can appear in the sockaddr_un structure: pathname, +.\" unnamed, and abstract. +.\" +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.\" +.\" Japanese Version Copyright (c) 1999 Shouichi Saito and +.\" NAKANO Takeo all rights reserved. +.\" Translated 1999-12-06, NAKANO Takeo +.\" based on the work by Shouichi Saito +.\" Updated 2003-01-07, Akihiro MOTOKI +.\" Updated 2005-02-21, Akihiro MOTOKI +.\" Updated 2005-12-26, Akihiro MOTOKI +.\" Updated 2008-08-08, Akihiro MOTOKI, LDP v3.05 +.\" +.TH UNIX 7 2020\-11\-01 Linux "Linux Programmer's Manual" +.SH 名前 +unix \- ローカルな プロセス間通信用のソケット +.SH 書式 +\fB#include \fP +.br +\fB#include \fP +.PP +\fIunix_socket\fP\fB = socket(AF_UNIX, type, 0);\fP +.br +\fIerror\fP\fB = socketpair(AF_UNIX, type, 0, int *\fP\fIsv\fP\fB);\fP +.SH 説明 +\fBAF_UNIX\fP (\fBAF_LOCAL\fP とも言われる) ソケットファミリーは、同じマシン上で +プロセス同士が 効率的に通信するために用いられる。伝統的に、UNIX ドメイン +ソケットは、名前なしにもできるし、 (ソケット型であると印のついた) ファイル +システムのパス名に 結び付けることもできる。さらに Linux では、ファイル +システムに依存しない抽象名前空間 (abstract namespace) もサポートしている。 +.PP +Valid socket types in the UNIX domain are: \fBSOCK_STREAM\fP, for a +stream\-oriented socket; \fBSOCK_DGRAM\fP, for a datagram\-oriented socket that +preserves message boundaries (as on most UNIX implementations, UNIX domain +datagram sockets are always reliable and don't reorder datagrams); and +(since Linux 2.6.4) \fBSOCK_SEQPACKET\fP, for a sequenced\-packet socket that +is connection\-oriented, preserves message boundaries, and delivers messages +in the order that they were sent. +.PP +UNIX ドメインソケットでは、補助データを使って ファイルディスクリプターや +プロセスの信任状 (credential) を 送受信することもできる。 +.SS アドレスのフォーマット +UNIX ドメインソケットのアドレスは以下の構造体で表現される。 +.PP +.in +4n +.EX +.\" #define UNIX_PATH_MAX 108 +.\" +struct sockaddr_un { + sa_family_t sun_family; /* AF_UNIX */ + char sun_path[108]; /* Pathname */ +}; +.EE +.in +.PP +The \fIsun_family\fP field always contains \fBAF_UNIX\fP. On Linux, \fIsun_path\fP +is 108 bytes in size; see also NOTES, below. +.PP +様々なシステムコール (例えば \fBbind\fP(2), \fBconnect\fP(2), \fBsendto\fP(2)) は入力として +\fIsockaddr_un\fP 引き数を取る。 他のいくつかのシステムコール (例えば \fBgetsockname\fP(2), +\fBgetpeername\fP(2), \fBrecvfrom\fP(2), \fBaccept\fP(2)) はこの型の引き数を返す。 +.PP +\fIsockaddr_un\fP 構造体では 3 種類のアドレスが区別される。 +.IP * 3 +\fIpathname (パス名)\fP: \fBbind\fP(2) を使って、UNIX ドメインソケットを、 +ヌル終端されたファイルシステム上のパス名に結び付けることができる。 (上述のいずれかのシステムコールにより) ソケットのアドレスが返される際、 +その長さは +.IP + offsetof(struct sockaddr_un, sun_path) + strlen(sun_path) + 1 +.IP +であり、 \fIsun_path\fP にはヌル終端されたパス名が格納される。 (Linux では、上記の \fBoffsetof\fP() 式は +\fIsizeof(sa_family_t)\fP の値と同じだが、 他の実装では \fIsun_path\fP の前に他のフィールドが含まれる場合もある。 +そのため、 \fBoffsetof\fP() 式を使う方がより移植性のある方法でアドレス構造体のサイズを知ることができる。) +.IP +パス名ソケットの詳細については、後で説明する。 +.IP * +.\" There is quite some variation across implementations: FreeBSD +.\" says the length is 16 bytes, HP-UX 11 says it's zero bytes. +\fIunnamed (名前なし)\fP: \fBbind\fP(2) を使ってパス名に結び付けることができないストリーム型のソケットは 名前を持たない。同様に、 +\fBsocketpair\fP(2) で作成される 2 つのソケットも名前を持たない。 名前なしのソケットのアドレスを返す際には、 その長さは +\fIsizeof(sa_family_t)\fP であり、 \fIsun_path\fP は検査すべきではない。 +.IP * +\fIabstract (抽象)\fP: 抽象ソケットアドレスは、 \fIsun_path[0]\fP がヌルバイト (\(aq\e0\(aq) であることから +(パス名ソケットから) 区別できる。 この名前空間におけるソケットのアドレスは、 \fIsun_path\fP の残りのバイトの、 +アドレス構造体の指定された長さの範囲で表される (名前中のヌルバイトには特別な意味はない)。 この名前はファイルシステムのパス名とは何の関係もない。 +抽象ソケットのアドレスを返される際には、 返される \fIaddrlen\fP は \fIsizeof(sa_family_t)\fP より大きく (つまり 2 +より大きく)、 ソケットの名前は \fIsun_path\fP の最初の \fI(addrlen \- sizeof(sa_family_t))\fP +バイトに格納される。 +.SS パス名ソケット +ソケットにパス名を結びつける際に、 最大限の移植性を持たせ、コーディングを簡単にするためのルールがいくつかある。 +.IP * 3 +\fIsun_path\fP のパス名はヌル終端すべきである。 +.IP * +終端のヌルバイトを含めたパス名の長さは \fIsun_path\fP の大きさを超えないようにすべきである。 +.IP * +\fIsockaddr_un\fP 構造体の終わりを示す \fIaddrlen\fP 引き数は最低でも以下の値を持つべきである。 +.IP +.nf + offsetof(struct sockaddr_un, sun_path)+strlen(addr.sun_path)+1 +.fi +.IP +もしくは、もっと簡単には、 \fIaddrlen\fP に \fIsizeof(struct sockaddr_un)\fP を指定することもできる。 +.PP +.\" Linux does this, including for the case where the supplied path +.\" is 108 bytes +UNIX ドメインソケットアドレスの扱いが上記のルールに従っていない実装もいくつかある。 (全部ではないが) いくつかの実装では、 +\fIsun_path\fP に文字列終端の NULL がなかった場合に終端の NULL が追加される。 +.PP +.\" HP-UX +.\" Modern BSDs generally have 104, Tru64 and AIX have 104, +.\" Solaris and Irix have 108 +移植性があるアプリケーションを作成する際には、 いくつかの実装では \fIsun_path\fP は 92 バイトしかないという点にも留意しておくとよい。 +.PP +.\" +様々なシステムコール (\fBaccept\fP(2), \fBrecvfrom\fP(2), \fBgetsockname\fP(2), +\fBgetpeername\fP(2)) がソケットアドレス構造体を返す。 これらのシステムコールが UNIX ドメインソケットに対して呼ばれた際には、 +これらの呼び出しに渡す \fIaddrlen\fP 引き数は上記の説明のように初期化すべきである。 +リターン時には、この引き数にはアドレス構造体の「実際の」サイズが設定される。 呼び出し側ではこの引き数で返された値を確認すべきである。 +返された値が入力値よりも大きい場合、 \fIsun_path\fP に終端の NULL バイトが存在する保証はない (「バグ」を参照)。 +.SS "Pathname socket ownership and permissions" +In the Linux implementation, pathname sockets honor the permissions of the +directory they are in. Creation of a new socket fails if the process does +not have write and search (execute) permission on the directory in which the +socket is created. +.PP +On Linux, connecting to a stream socket object requires write permission on +that socket; sending a datagram to a datagram socket likewise requires write +permission on that socket. POSIX does not make any statement about the +effect of the permissions on a socket file, and on some systems (e.g., older +BSDs), the socket permissions are ignored. Portable programs should not +rely on this feature for security. +.PP +When creating a new socket, the owner and group of the socket file are set +according to the usual rules. The socket file has all permissions enabled, +other than those that are turned off by the process \fBumask\fP(2). +.PP +.\" However, fchown() and fchmod() do not seem to have an effect +.\" +The owner, group, and permissions of a pathname socket can be changed (using +\fBchown\fP(2) and \fBchmod\fP(2)). +.SS 抽象ソケット +Socket permissions have no meaning for abstract sockets: the process +\fBumask\fP(2) has no effect when binding an abstract socket, and changing the +ownership and permissions of the object (via \fBfchown\fP(2) and \fBfchmod\fP(2)) +has no effect on the accessibility of the socket. +.PP +Abstract sockets automatically disappear when all open references to the +socket are closed. +.PP +.\" +The abstract socket namespace is a nonportable Linux extension. +.SS ソケットオプション +歴史的な理由により、これらのオプションは たとえ \fBAF_UNIX\fP 固有のオプションであっても \fBSOL_SOCKET\fP 型で指定する。 +ソケットファミリーとして \fBSOL_SOCKET\fP を指定すると、 \fBsetsockopt\fP(2) でオプションが設定でき、 +\fBgetsockopt\fP(2) で取得ができる。 +.TP +\fBSO_PASSCRED\fP +Enabling this socket option causes receipt of the credentials of the sending +process in an \fBSCM_CREDENTIALS ancillary\fP message in each subsequently +received message. The returned credentials are those specified by the +sender using \fBSCM_CREDENTIALS\fP, or a default that includes the sender's +PID, real user ID, and real group ID, if the sender did not specify +\fBSCM_CREDENTIALS\fP ancillary data. +.IP +このオプションがセットされていて、まだソケットが接続されていないと、抽象名前空間に他と重ならない名前が自動的に生成される。 +.IP +The value given as an argument to \fBsetsockopt\fP(2) and returned as the +result of \fBgetsockopt\fP(2) is an integer boolean flag. +.TP +\fBSO_PASSSEC\fP +Enables receiving of the SELinux security label of the peer socket in an +ancillary message of type \fBSCM_SECURITY\fP (see below). +.IP +The value given as an argument to \fBsetsockopt\fP(2) and returned as the +result of \fBgetsockopt\fP(2) is an integer boolean flag. +.IP +.\" commit 877ce7c1b3afd69a9b1caeb1b9964c992641f52a +.\" commit 37a9a8df8ce9de6ea73349c9ac8bdf6ba4ec4f70 +The \fBSO_PASSSEC\fP option is supported for UNIX domain datagram sockets since +Linux 2.6.18; support for UNIX domain stream sockets was added in Linux 4.2. +.TP +\fBSO_PEEK_OFF\fP +\fBsocket\fP(7) を参照。 +.TP +\fBSO_PEERCRED\fP +This read\-only socket option returns the credentials of the peer process +connected to this socket. The returned credentials are those that were in +effect at the time of the call to \fBconnect\fP(2) or \fBsocketpair\fP(2). +.IP +The argument to \fBgetsockopt\fP(2) is a pointer to a \fIucred\fP structure; +define the \fB_GNU_SOURCE\fP feature test macro to obtain the definition of +that structure from \fI\fP. +.IP +The use of this option is possible only for connected \fBAF_UNIX\fP stream +sockets and for \fBAF_UNIX\fP stream and datagram socket pairs created using +\fBsocketpair\fP(2). +.TP +\fBSO_PEERSEC\fP +This read\-only socket option returns the security context of the peer socket +connected to this socket. By default, this will be the same as the security +context of the process that created the peer socket unless overridden by the +policy or by a process with the required permissions. +.IP +The argument to \fBgetsockopt\fP(2) is a pointer to a buffer of the specified +length in bytes into which the security context string will be copied. If +the buffer length is less than the length of the security context string, +then \fBgetsockopt\fP(2) returns \-1, sets \fIerrno\fP to \fBERANGE\fP, and returns +the required length via \fIoptlen\fP. The caller should allocate at least +\fBNAME_MAX\fP bytes for the buffer initially, although this is not guaranteed +to be sufficient. Resizing the buffer to the returned length and retrying +may be necessary. +.IP +The security context string may include a terminating null character in the +returned length, but is not guaranteed to do so: a security context "foo" +might be represented as either {'f','o','o'} of length 3 or +{'f','o','o','\e0'} of length 4, which are considered to be +interchangeable. The string is printable, does not contain non\-terminating +null characters, and is in an unspecified encoding (in particular, it is not +guaranteed to be ASCII or UTF\-8). +.IP +.\" commit 0b811db2cb2aabc910e53d34ebb95a15997c33e7 +.\" +The use of this option for sockets in the \fBAF_UNIX\fP address family is +supported since Linux 2.6.2 for connected stream sockets, and since Linux +4.18 also for stream and datagram socket pairs created using +\fBsocketpair\fP(2). +.SS "自動バインド (autobind) 機能" +.\" i.e., sizeof(short) +\fBbind\fP(2) 呼び出しで \fIsizeof(sa_family_t)\fP として \fIaddrlen\fP を指定するか、 +アドレスに明示的にバインドされていないソケットに対して +\fBSO_PASSCRED\fP ソケットオプションが指定されていた場合、 +そのソケットは抽象アドレスに自動的にバインドされる。 +このアドレスは、1 個のヌルバイトの後に、文字集合 \fI[0\-9a\-f]\fP のバイトが +5 個続く形式である。したがって、自動的にバインドされるアドレス数には +2^20 個という上限が存在する。 +(Linux 2.1.15 以降で、自動バインド機能が追加されたときには、 +8 バイトが使われており、自動バインドアドレス数の上限は 2^32 であった。 +Linux 2.3.15 で 5 バイトに変更された。) +.SS "ソケット API" +この節では、Linux の UNIX ドメインソケットでの、ドメイン固有の詳細仕様と +ソケット API でサポートされていない機能について説明する。 +.PP +UNIX ドメインソケットでは、帯域外データ (out\-of\-band data) の 送信 +(\fBsend\fP(2) と \fBrecv\fP(2) の \fBMSG_OOB\fP フラグ) はサポートされていない。 +.PP +\fBsend\fP(2) \fBMSG_MORE\fP フラグは UNIX ドメインソケットではサポートされていない。 +.PP +.\" commit 9f6f9af7694ede6314bed281eec74d588ba9474f +Linux 3.4 より前では、 \fBrecv\fP(2) の \fIflags\fP 引き数での \fBMSG_TRUNC\fP の使用は UNIX +ドメインソケットではサポートされていなかった。 +.PP +\fBSO_SNDBUF\fP ソケットオプションは UNIX ドメインソケットで効果を持つが、 +\fBSO_RCVBUF\fP は効果がない。 データグラムソケットでは、 \fBSO_SNDBUF\fP の値が +出力データグラムの上限サイズとなる。 実際の上限値は、 \fBSO_SNDBUF\fP オプション +として設定された値の 2倍 (\fBsocket\fP(7) 参照) からオーバヘッドとして使用される +32 バイトを引いた値となる。 +.SS 補助メッセージ +補助データを送受するには、 \fBsendmsg\fP(2) や \fBrecvmsg\fP(2) を使用する。 +歴史的な理由により、以下に示す補助メッセージの型は たとえ \fBAF_UNIX\fP 固有のものであっても \fBSOL_SOCKET\fP 型で指定する。 +これらを送るには、構造体 \fIcmsghdr\fP の \fIcmsg_level\fP フィールドに \fBSOL_SOCKET\fP をセットし、 +\fIcmsg_type\fP フィールドにタイプをセットする。 詳細は \fBcmsg\fP(3) を見よ。 +.TP +\fBSCM_RIGHTS\fP +他のプロセスでオープンされたファイルディスクリプターのセットを送受信する。 データ部分にファイルディスクリプターの整数配列が入っている。 +.IP +Commonly, this operation is referred to as "passing a file descriptor" to +another process. However, more accurately, what is being passed is a +reference to an open file description (see \fBopen\fP(2)), and in the receiving +process it is likely that a different file descriptor number will be used. +Semantically, this operation is equivalent to duplicating (\fBdup\fP(2)) a +file descriptor into the file descriptor table of another process. +.IP +If the buffer used to receive the ancillary data containing file descriptors +is too small (or is absent), then the ancillary data is truncated (or +discarded) and the excess file descriptors are automatically closed in the +receiving process. +.IP +If the number of file descriptors received in the ancillary data would cause +the process to exceed its \fBRLIMIT_NOFILE\fP resource limit (see +\fBgetrlimit\fP(2)), the excess file descriptors are automatically closed in +the receiving process. +.IP +.\" commit bba14de98753cb6599a2dae0e520714b2153522d +The kernel constant \fBSCM_MAX_FD\fP defines a limit on the number of file +descriptors in the array. Attempting to send an array larger than this +limit causes \fBsendmsg\fP(2) to fail with the error \fBEINVAL\fP. \fBSCM_MAX_FD\fP +has the value 253 (or 255 in kernels before 2.6.38). +.TP +\fBSCM_CREDENTIALS\fP +UNIX 信任状を送受信する。これは認証に用いることができる。 +信任状は \fIstruct ucred\fP の補助メッセージとして渡される。 +この構造体は \fI\fP で以下のように定義されている。 +.IP +.in +4n +.EX +struct ucred { + pid_t pid; /* Process ID of the sending process */ + uid_t uid; /* User ID of the sending process */ + gid_t gid; /* Group ID of the sending process */ +}; +.EE +.in +.IP +glibc 2.8 以降では、この構造体の定義を得るためには +(\fIどの\fPヘッダーファイルをインクルードするよりも前に) +機能検査マクロ \fB_GNU_SOURCE\fP を定義しなければならない。 +.IP +The credentials which the sender specifies are checked by the kernel. A +privileged process is allowed to specify values that do not match its own. +The sender must specify its own process ID (unless it has the capability +\fBCAP_SYS_ADMIN\fP, in which case the PID of any existing process may be +specified), its real user ID, effective user ID, or saved set\-user\-ID +(unless it has \fBCAP_SETUID\fP), and its real group ID, effective group ID, or +saved set\-group\-ID (unless it has \fBCAP_SETGID\fP). +.IP +To receive a \fIstruct ucred\fP message, the \fBSO_PASSCRED\fP option must be +enabled on the socket. +.TP +\fBSCM_SECURITY\fP +Receive the SELinux security context (the security label) of the peer +socket. The received ancillary data is a null\-terminated string containing +the security context. The receiver should allocate at least \fBNAME_MAX\fP +bytes in the data portion of the ancillary message for this data. +.IP +To receive the security context, the \fBSO_PASSSEC\fP option must be enabled on +the socket (see above). +.PP +When sending ancillary data with \fBsendmsg\fP(2), only one item of each of the +above types may be included in the sent message. +.PP +At least one byte of real data should be sent when sending ancillary data. +On Linux, this is required to successfully send ancillary data over a UNIX +domain stream socket. When sending ancillary data over a UNIX domain +datagram socket, it is not necessary on Linux to send any accompanying real +data. However, portable applications should also include at least one byte +of real data when sending ancillary data over a datagram socket. +.PP +When receiving from a stream socket, ancillary data forms a kind of barrier +for the received data. For example, suppose that the sender transmits as +follows: +.PP +.RS +.PD 0 +.IP 1. 3 +\fBsendmsg\fP(2) of four bytes, with no ancillary data. +.IP 2. +\fBsendmsg\fP(2) of one byte, with ancillary data. +.IP 3. +\fBsendmsg\fP(2) of four bytes, with no ancillary data. +.PD +.RE +.PP +Suppose that the receiver now performs \fBrecvmsg\fP(2) calls each with a +buffer size of 20 bytes. The first call will receive five bytes of data, +along with the ancillary data sent by the second \fBsendmsg\fP(2) call. The +next call will receive the remaining four bytes of data. +.PP +.\" +If the space allocated for receiving incoming ancillary data is too small +then the ancillary data is truncated to the number of headers that will fit +in the supplied buffer (or, in the case of an \fBSCM_RIGHTS\fP file descriptor +list, the list of file descriptors may be truncated). If no buffer is +provided for incoming ancillary data (i.e., the \fImsg_control\fP field of the +\fImsghdr\fP structure supplied to \fBrecvmsg\fP(2) is NULL), then the incoming +ancillary data is discarded. In both of these cases, the \fBMSG_CTRUNC\fP flag +will be set in the \fImsg.msg_flags\fP value returned by \fBrecvmsg\fP(2). +.SS ioctl +以下の \fBioctl\fP(2) 呼び出しは \fIvalue\fP に情報を入れて返す。 +正しい書式は以下の通り。 +.PP +.RS +.nf +\fBint\fP\fI value\fP\fB;\fP +\fIerror\fP\fB = ioctl(\fP\fIunix_socket\fP\fB, \fP\fIioctl_type\fP\fB, &\fP\fIvalue\fP\fB);\fP +.fi +.RE +.PP +\fIioctl_type\fP には以下を指定できる: +.TP +\fBSIOCINQ\fP +.\" FIXME . http://sources.redhat.com/bugzilla/show_bug.cgi?id=12002, +.\" filed 2010-09-10, may cause SIOCINQ to be defined in glibc headers +.\" SIOCOUTQ also has an effect for UNIX domain sockets, but not +.\" quite what userland might expect. It seems to return the number +.\" of bytes allocated for buffers containing pending output. +.\" That number is normally larger than the number of bytes of pending +.\" output. Since this info is, from userland's point of view, imprecise, +.\" and it may well change, probably best not to document this now. +For \fBSOCK_STREAM\fP sockets, this call returns the number of unread bytes in +the receive buffer. The socket must not be in LISTEN state, otherwise an +error (\fBEINVAL\fP) is returned. \fBSIOCINQ\fP is defined in +\fI\fP. Alternatively, you can use the synonymous +\fBFIONREAD\fP, defined in \fI\fP. For \fBSOCK_DGRAM\fP +sockets, the returned value is the same as for Internet domain datagram +sockets; see \fBudp\fP(7). +.SH エラー +.TP +\fBEADDRINUSE\fP +指定したローカルアドレスが既に使用されているか、ファイルシステムの +ソケットオブジェクトが既に存在している。 +.TP +\fBEBADF\fP +This error can occur for \fBsendmsg\fP(2) when sending a file descriptor as +ancillary data over a UNIX domain socket (see the description of +\fBSCM_RIGHTS\fP, above), and indicates that the file descriptor number that is +being sent is not valid (e.g., it is not an open file descriptor). +.TP +\fBECONNREFUSED\fP +\fBconnect\fP(2) により指定されたリモートアドレスが接続待ちソケットではなかった。 +このエラーはターゲットのパス名がソケットでなかった場合にも発生する。 +.TP +\fBECONNRESET\fP +リモートソケットが予期しないかたちでクローズされた。 +.TP +\fBEFAULT\fP +ユーザーメモリーアドレスが不正。 +.TP +\fBEINVAL\fP +渡した引数が不正。よくある原因としては、渡したアドレスの \fIsun_type\fP フィール +ドに \fBAF_UNIX\fP が指定されていなかった、行おうとした操作に対してソケットが有 +効な状態ではなかった、など。 +.TP +\fBEISCONN\fP +既に接続されているソケットに対して \fBconnect\fP(2) が呼ばれた。または、指定したターゲットアドレスが 既に接続済みのソケットだった。 +.TP +\fBENOENT\fP +\fBconnect\fP(2) に指定されたリモートアドレスのパス名が存在しなかった。 +.TP +\fBENOMEM\fP +メモリーが足りない。 +.TP +\fBENOTCONN\fP +ソケット操作にターゲットアドレスが必要だが、 このソケットは接続されていない。 +.TP +\fBEOPNOTSUPP\fP +ストリーム指向でないソケットに対してストリーム操作が呼び出された。 または帯域外データオプションを用いようとした。 +.TP +\fBEPERM\fP +送信者が \fIstruct ucred\fP に不正な信任状を渡した。 +.TP +\fBEPIPE\fP +リモートソケットがストリームソケット上でクローズされた。 可能な場合は \fBSIGPIPE\fP も同時に送られる。これを避けるには +\fBMSG_NOSIGNAL\fP フラグを \fBsend\fP(2) や \fBsendmsg\fP(2) に渡す。 +.TP +\fBEPROTONOSUPPORT\fP +渡されたプロトコルが \fBAF_UNIX\fP でない。 +.TP +\fBEPROTOTYPE\fP +リモートソケットとローカルソケットのタイプが一致していなかった (\fBSOCK_DGRAM\fP と \fBSOCK_STREAM\fP)。 +.TP +\fBESOCKTNOSUPPORT\fP +未知のソケットタイプ。 +.TP +\fBESRCH\fP +While sending an ancillary message containing credentials +(\fBSCM_CREDENTIALS\fP), the caller specified a PID that does not match any +existing process. +.TP +\fBETOOMANYREFS\fP +This error can occur for \fBsendmsg\fP(2) when sending a file descriptor as +ancillary data over a UNIX domain socket (see the description of +\fBSCM_RIGHTS\fP, above). It occurs if the number of "in\-flight" file +descriptors exceeds the \fBRLIMIT_NOFILE\fP resource limit and the caller does +not have the \fBCAP_SYS_RESOURCE\fP capability. An in\-flight file descriptor +is one that has been sent using \fBsendmsg\fP(2) but has not yet been accepted +in the recipient process using \fBrecvmsg\fP(2). +.IP +.\" commit 712f4aad406bb1ed67f3f98d04c044191f0ff593 +This error is diagnosed since mainline Linux 4.5 (and in some earlier kernel +versions where the fix has been backported). In earlier kernel versions, it +was possible to place an unlimited number of file descriptors in flight, by +sending each file descriptor with \fBsendmsg\fP(2) and then closing the file +descriptor so that it was not accounted against the \fBRLIMIT_NOFILE\fP +resource limit. +.PP +他にも汎用のソケット層でエラーが起こったり、 ファイルシステム上にソケットオブジェクトを作ろうとした場合に ファイルシステムのエラーが起こることがある。 +それぞれの詳細は適切な man ページを参照すること。 +.SH バージョン +\fBSCM_CREDENTIALS\fP と抽象名前空間は、Linux 2.2 で導入された。 移植性が必要なプログラムでは使うべきではない。 (BSD +由来のシステムの中にも信任状の送受信をサポートしているものがあるが、 その実装の詳細はシステムによって異なる) +.SH 注意 +ファイル名を指定してソケットにバインドすると、ファイルシステムにソケットが +生成される。これは必要なくなったときに呼びだしたユーザーが削除しなければ +ならない (\fBunlink\fP(2) を用いる)。 UNIX で通常使われる「背後で閉じる方式」 +が適用される。ソケットはいつでも unlink することができ、最後の参照が +クローズされたときにファイルシステムから削除される。 +.PP +\fBSOCK_STREAM\fP ソケット上でファイルディスクリプターや信任状を渡すためには、同じ \fBsendmsg\fP(2) や +\fBrecvmsg\fP(2) コールで補助データ以外のデータを少なくとも 1 バイト送信/受信しなければならない。 +.PP +.\" +UNIX ドメインのストリームソケットでは、 帯域外データの概念はサポートされない。 +.SH バグ +.\" The behavior on Solaris is quite similar. +ソケットをアドレスに結びつける際、 Linux は終端の NULL が \fIsun_path\fP になかった場合に追加する実装の一つである。 +ほとんどの場合、 これは問題にならない。 ソケットアドレスが取得された際、ソケットをバインドしたときに指定したものより 1 バイト長くなるだけである。 +しかしながら、紛らわしい動作が起こる場合が一つある。 ソケットをバインドした際に 108 個の NULL でないバイトを指定した場合、 終端の NULL +が追加されるとパス名の長さが \fIsizeof(sun_path)\fP を超えてしまう。 結果として、(例えば \fBaccept\fP(2) で) +ソケットアドレスを取得した際に、 値を取得する呼び出しの入力の \fIaddress\fP 引き数に \fIsizeof(struct +sockaddr_un)\fP を指定したとすると、 返されるアドレス構造体は \fIsun_path\fP に終端の NULL を「含まない」ことになる。 +.PP +.\" i.e., traditional BSD +さらに、 いくつかの実装では、ソケットをバインドする際に終端の NULL が必要ではなく (\fIaddrlen\fP 引き数を使って \fIsun_path\fP +の長さが判定される)、 このような実装でソケットアドレスを取得する際には、 \fIsun_path\fP に終端の NULL は存在しない。 +.PP +ソケットアドレスを取得するアプリケーションでは、 \fIsun_path\fP に終端の NULL が存在しないという移植性の問題を、 +パス名の有効なバイト数が以下のようになると事実を考慮することで取り扱うことができる。 +.PP +.\" The following patch to amend kernel behavior was rejected: +.\" http://thread.gmane.org/gmane.linux.kernel.api/2437 +.\" Subject: [patch] Fix handling of overlength pathname in AF_UNIX sun_path +.\" 2012-04-17 +.\" And there was a related discussion in the Austin list: +.\" http://thread.gmane.org/gmane.comp.standards.posix.austin.general/5735 +.\" Subject: Having a sun_path with no null terminator +.\" 2012-04-18 +.\" +.\" FIXME . Track http://austingroupbugs.net/view.php?id=561 + strnlen(addr.sun_path, addrlen \- offsetof(sockaddr_un, sun_path)) +.PP +他の方法としては、 アプリケーションがソケットアドレスを取得する際、 取得の呼び出しを行う前に、 大きさが \fIsizeof(struct +sockaddr_un)+1\fP のバッファーを割り当てることもできる。 取得の呼び出しでは \fIaddrlen\fP に \fIsizeof(struct +sockaddr_un)\fP を指定すると、 余分な一つの 0 バイトにより \fIsun_path\fP で返される文字列に終端の NULL +が含まれることが保証される。 +.PP +.in +4n +.EX +void *addrp; + +addrlen = sizeof(struct sockaddr_un); +addrp = malloc(addrlen + 1); +if (addrp == NULL) + /* Handle error */ ; +memset(addrp, 0, addrlen + 1); + +if (getsockname(sfd, (struct sockaddr *) addrp, &addrlen)) == \-1) + /* handle error */ ; + +printf("sun_path = %s\en", ((struct sockaddr_un *) addrp)\->sun_path); +.EE +.in +.PP +アプリケーションが「パス名ソケット」の節で説明したルールにしたがってパス名を「作成」していれば、 このような分かりにくさは避けることができる。 +.SH 例 +The following code demonstrates the use of sequenced\-packet sockets for +local interprocess communication. It consists of two programs. The server +program waits for a connection from the client program. The client sends +each of its command\-line arguments in separate messages. The server treats +the incoming messages as integers and adds them up. The client sends the +command string "END". The server sends back a message containing the sum of +the client's integers. The client prints the sum and exits. The server +waits for the next client to connect. To stop the server, the client is +called with the command\-line argument "DOWN". +.PP +The following output was recorded while running the server in the background +and repeatedly executing the client. Execution of the server program ends +when it receives the "DOWN" command. +.SS 出力例 +.in +4n +.EX +$ \fB./server &\fP +[1] 25887 +$ \fB./client 3 4\fP +Result = 7 +$ \fB./client 11 \-5\fP +Result = 6 +$ \fB./client DOWN\fP +Result = 0 +[1]+ Done ./server +$ +.EE +.in +.SS プログラムのソース +\& +.EX +/* + * File connection.h + */ + +#define SOCKET_NAME "/tmp/9Lq7BNBnBycd6nxy.socket" +#define BUFFER_SIZE 12 + +/* + * File server.c + */ + +#include +#include +#include +#include +#include +#include +#include "connection.h" + +int +main(int argc, char *argv[]) +{ + struct sockaddr_un name; + int down_flag = 0; + int ret; + int connection_socket; + int data_socket; + int result; + char buffer[BUFFER_SIZE]; + + /* Create local socket. */ + + connection_socket = socket(AF_UNIX, SOCK_SEQPACKET, 0); + if (connection_socket == \-1) { + perror("socket"); + exit(EXIT_FAILURE); + } + + /* + * For portability clear the whole structure, since some + * implementations have additional (nonstandard) fields in + * the structure. + */ + + memset(&name, 0, sizeof(name)); + + /* Bind socket to socket name. */ + + name.sun_family = AF_UNIX; + strncpy(name.sun_path, SOCKET_NAME, sizeof(name.sun_path) \- 1); + + ret = bind(connection_socket, (const struct sockaddr *) &name, + sizeof(name)); + if (ret == \-1) { + perror("bind"); + exit(EXIT_FAILURE); + } + + /* + * Prepare for accepting connections. The backlog size is set + * to 20. So while one request is being processed other requests + * can be waiting. + */ + + ret = listen(connection_socket, 20); + if (ret == \-1) { + perror("listen"); + exit(EXIT_FAILURE); + } + + /* This is the main loop for handling connections. */ + + for (;;) { + + /* Wait for incoming connection. */ + + data_socket = accept(connection_socket, NULL, NULL); + if (data_socket == \-1) { + perror("accept"); + exit(EXIT_FAILURE); + } + + result = 0; + for (;;) { + + /* Wait for next data packet. */ + + ret = read(data_socket, buffer, sizeof(buffer)); + if (ret == \-1) { + perror("read"); + exit(EXIT_FAILURE); + } + + /* Ensure buffer is 0\-terminated. */ + + buffer[sizeof(buffer) \- 1] = 0; + + /* Handle commands. */ + + if (!strncmp(buffer, "DOWN", sizeof(buffer))) { + down_flag = 1; + break; + } + + if (!strncmp(buffer, "END", sizeof(buffer))) { + break; + } + + /* Add received summand. */ + + result += atoi(buffer); + } + + /* Send result. */ + + sprintf(buffer, "%d", result); + ret = write(data_socket, buffer, sizeof(buffer)); + if (ret == \-1) { + perror("write"); + exit(EXIT_FAILURE); + } + + /* Close socket. */ + + close(data_socket); + + /* Quit on DOWN command. */ + + if (down_flag) { + break; + } + } + + close(connection_socket); + + /* Unlink the socket. */ + + unlink(SOCKET_NAME); + + exit(EXIT_SUCCESS); +} + +/* + * File client.c + */ + +#include +#include +#include +#include +#include +#include +#include +#include "connection.h" + +int +main(int argc, char *argv[]) +{ + struct sockaddr_un addr; + int ret; + int data_socket; + char buffer[BUFFER_SIZE]; + + /* Create local socket. */ + + data_socket = socket(AF_UNIX, SOCK_SEQPACKET, 0); + if (data_socket == \-1) { + perror("socket"); + exit(EXIT_FAILURE); + } + + /* + * For portability clear the whole structure, since some + * implementations have additional (nonstandard) fields in + * the structure. + */ + + memset(&addr, 0, sizeof(addr)); + + /* Connect socket to socket address */ + + addr.sun_family = AF_UNIX; + strncpy(addr.sun_path, SOCKET_NAME, sizeof(addr.sun_path) \- 1); + + ret = connect(data_socket, (const struct sockaddr *) &addr, + sizeof(addr)); + if (ret == \-1) { + fprintf(stderr, "The server is down.\en"); + exit(EXIT_FAILURE); + } + + /* Send arguments. */ + + for (int i = 1; i < argc; ++i) { + ret = write(data_socket, argv[i], strlen(argv[i]) + 1); + if (ret == \-1) { + perror("write"); + break; + } + } + + /* Request result. */ + + strcpy(buffer, "END"); + ret = write(data_socket, buffer, strlen(buffer) + 1); + if (ret == \-1) { + perror("write"); + exit(EXIT_FAILURE); + } + + /* Receive result. */ + + ret = read(data_socket, buffer, sizeof(buffer)); + if (ret == \-1) { + perror("read"); + exit(EXIT_FAILURE); + } + + /* Ensure buffer is 0\-terminated. */ + + buffer[sizeof(buffer) \- 1] = 0; + + printf("Result = %s\en", buffer); + + /* Close socket. */ + + close(data_socket); + + exit(EXIT_SUCCESS); +} +.EE +.PP +\fBSCM_RIGHTS\fP の使用例については \fBcmsg\fP(3) を参照。 +.SH 関連項目 +\fBrecvmsg\fP(2), \fBsendmsg\fP(2), \fBsocket\fP(2), \fBsocketpair\fP(2), \fBcmsg\fP(3), +\fBcapabilities\fP(7), \fBcredentials\fP(7), \fBsocket\fP(7), \fBudp\fP(7) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は +\%https://www.kernel.org/doc/man\-pages/ に書かれている。 diff --git a/manual/LDP_man-pages/draft/man7/x25.7 b/manual/LDP_man-pages/draft/man7/x25.7 index 7c306d35..1e4be13b 100644 --- a/manual/LDP_man-pages/draft/man7/x25.7 +++ b/manual/LDP_man-pages/draft/man7/x25.7 @@ -20,7 +20,7 @@ .\" .TH X25 7 2017\-09\-15 Linux "Linux Programmer's Manual" .SH 名前 -x25 \- ITU\-T X.25 / ISO\-8208 protocol interface +x25 \- ITU\-T X.25 / ISO\-8208 プロトコルインターフェース .SH 書式 \fB#include \fP .br diff --git a/manual/LDP_man-pages/draft/man8/nscd.8 b/manual/LDP_man-pages/draft/man8/nscd.8 index 47863b60..81870c6b 100644 --- a/manual/LDP_man-pages/draft/man8/nscd.8 +++ b/manual/LDP_man-pages/draft/man8/nscd.8 @@ -38,9 +38,8 @@ .SH 名前 nscd \- ネームサービスキャッシュデーモン .SH 説明 -\fBnscd\fP is a daemon that provides a cache for the most common name service -requests. The default configuration file, \fI/etc/nscd.conf\fP, determines the -behavior of the cache daemon. See \fBnscd.conf\fP(5). +\fBnscd\fP は一般的なネームサービスに必要な多くのものを キャッシュとして提供するデーモンである。 デフォルトの設定ファイル +\fI/etc/nscd.conf\fP でキャッシュデーモンの動作を決定する。 \fBnscd.conf\fP(5) を見よ。 .PP \fBnscd\fP provides caching for accesses of the \fBpasswd\fP(5), \fBgroup\fP(5), \fBhosts\fP(5) \fBservices\fP(5) and \fInetgroup\fP databases through standard libc -- 2.11.0