Zero or more flags (in any order) that modify the meaning of the conversion specification.
変換指定の意味を修飾する0個以上のフラグ(順不同)
フラグ
英語説明 適当翻訳
-
The result of the conversion is left-justified within the field. (It is right-justified if this flag is not specified.) フィールドの中で左寄せされるんだぜ。(これ指定されなかったら右寄せよ)
+
The result of a signed conversion always begins with a plus or minus sign. (It begins with a sign only when a negative value is converted if this flag is not specified.) 符号付き変換は常に+か-符号から始まるぜ。(これ指定されなかったら負の数の時だけ符号から始めちゃう。)
space
If the first character of a signed conversion is not a sign, or if a signed conversion results in no characters, a space is prefixed to the result. If the space and + flags both appear, the space flag is ignored. 符号付き変換で最初の文字が符号じゃないか、符号付き変換が文字にならないんなら、空白が前につくぜ。空白と+フラグが両方あったら空白フラグは無視されちゃうんだな。
#
The result is converted to an ‘‘alternative form’’. For o conversion, it increases the precision, if and only if necessary, to force the first digit of the result to be a zero (if the value and precision are both 0, a single 0 is printed). For x (or X) conversion, a nonzero result has 0x (or 0X) prefixed to it. For a, A, e, E, f, F, g, and G conversions, the result of converting a floating-point number always contains a decimal-point character, even if no digits follow it. (Normally, a decimal-point character appears in the result of these conversions only if a digit follows it.) For g and G conversions, trailing zeros are not removed from the result. For other conversions, the behavior is undefined. "alternative form(選択方式、代替形態)"に変換されっぜ。o変換に対しては、必要な時に限って、最初の桁を0に強制するんで精度を拡張する(値と精度が両方0なら一つの0が出力される)。x(かX)変換に対しては、非0は0x(か0X)が前に付く。 (続きは、気が向いたら。。)
0
For d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversions, leading zeros (following any indication of sign or base) are used to pad to the field width rather than performing space padding, except when converting an infinity or NaN. If the 0 and - flags both appear, the 0 flag is ignored. For d, i, o, u, x, and X conversions, if a precision is specified, the 0 flag is ignored. For other conversions, the behavior is undefined. d,i,o,u,x,X,a,A,e,E,f,F,g,G変換に対して、無限大や非数に変換される時を除いて、最初に空白埋めが行われるんでなく(符号か基数表示の後に続いて)0がフィールド幅を埋める為に使われるぜ。0と-フラグ両方が使われると0フラグは無視されちゃうよ。d,i,o,u,x,X変換に対しては、精度が指定されちゃってると0フラグは無視されちゃうよ。他の変換では、どうなるか決めてないよ。
最小フィールド幅(minimum field width)
An optional minimum field width. If the converted value has fewer characters than the field width, it is padded with spaces (by default) on the left (or right, if the left adjustment flag, described later, has been given) to the field width. The field width takes the form of an asterisk * (described later) or a decimal integer.
任意のフィールド幅。変換値がフィールド幅より少ない文字数なら、フィールド幅まで(デフォルトで)空白を左に埋めるぜ(後で記述される(この記事では前だけど) 左寄せフラグがある場合は右に埋める)。フィールド幅はアスタリスク*(後で記述)の形式か10進数整数をとっちゃうよ。
.精度(precision)
An optional precision that gives the minimum number of digits to appear for the d, i, o, u, x, and X conversions, the number of digits to appear after the decimal-point character for a, A, e, E, f, and F conversions, the maximum number of significant digits for the g and G conversions, or the maximum number of bytes to be written for s conversions. The precision takes the form of a period (.) followed either by an asterisk * (described later) or by an optional decimal integer; if only the period is specified, the precision is taken as zero. If a precision appears with any other conversion specifier, the behavior is undefined.
d, i, o, u, x, X変換に対しては最小桁数、a, A, e, E, f, F変換に対しては小数点後の桁数、g, G変換に対しては最大有効桁数、s変換に対しては書かれるべき最大バイト数を表す任意の精度。精度はピリオド.とそれに続いてアスタリスク*(後で記述)か任意の10進数整数の形式をとるぜ。ピリオドだけ指定される場合は0として扱うんだぜ。精度がその他の変換指定子で表れる場合の動作は未定義だぜ。
浮動小数点の桁数だけだと思ってた…
長さ修飾子(length modifier)
An optional length modifier that specifies the size of the argument.
引数のサイズを指定する任意の長さ修飾子。
長さ修飾子
英語説明 適当翻訳
hh
Specifies that a following d, i, o, u, x, or X conversion specifier applies to a signed char or unsigned char argument (the argument will have been promoted according to the integer promotions, but its value shall be converted to signed char or unsigned char before printing); or that a following n conversion specifier applies to a pointer to a signed char argument. 後に続くd,i,o,u,x,X変換指定子がsigned charかunsigned char引数に適用されることを指定するぜ(引数は整数拡張に従って拡張されるよん。だけどその値は出力する前にsigned charかunsigned charに変換されるべきだよ。(詳しい人この意味教えて。。。))。または、後に続くn変換指定子がsigned char引数へのポインタに適用されることを指定するぜ。
h
Specifies that a following d, i, o, u, x, or X conversion specifier applies to a short int or unsigned short int argument (the argument will have been promoted according to the integer promotions, but its value shall be converted to short int or unsigned short int before printing); or that a following n conversion specifier applies to a pointer to a short int argument. 後に続くd,i,o,u,x,X変換指定子がshort intかunsigned short int引数に適用されることを指定するぜ(引数は整数拡張に従って拡張されるよん。だけどその値は出力する前にshort intかunsigned short intに変換されるべきだよ。)または、後に続くn変換指定子がshort int引数へのポインタに適用されることを指定するぜ。
l
Specifies that a following d, i, o, u, x, or X conversion specifier applies to a long int or unsigned long int argument; that a following n conversion specifier applies to a pointer to a long int argument; that a following c conversion specifier applies to a wint_t argument; that a following s conversion specifier applies to a pointer to a wchar_t argument; or has no effect on a following a, A, e, E, f, F, g, or G conversion specifier. 後に続くd,i,o,u,x,X変換指定子がlong intかunsigned long int引数に適用されることを指定するぜ。後に続くn変換指定子がlong int引数へのポインタに適用されることを指定するぜ。後に続くc変換指定子がwint_t引数に適用されることを指定するぜ。後に続くs変換指定子がwchar_t引数へのポインタに適用されることを指定するぜ。後に続くa,A,e,E,f,F,g,G変換指定子では何の効果もないよ。
ll
気が向いたらね。
j
気が向いたらね。。
z
Specifies that a following d, i, o, u, x, or X conversion specifier applies to a size_t or the corresponding signed integer type argument; or that a following n conversion specifier applies to a pointer to a signed integer type corresponding to size_t argument. 後に続くd,i,o,u,x,X変換指定子がsize_tか同様のsigned integer型引数に適用されることを指定するぜ。または後に続くn変換指定子がsize_t引数に相当するsigned integer型へのポインタに適用されることを指定するぜ。
t
Specifies that a following d, i, o, u, x, or X conversion specifier applies to a ptrdiff_t or the corresponding unsigned integer type argument; or that a following n conversion specifier applies to a pointer to a ptrdiff_t argument. 後に続くd,i,o,u,x,X変換指定子がptrdiff_tか同様のunsigned integer type引数に適用されることを指定するぜ。または後に続くn変換指定子がptrdiff_t引数へのポインタに適用されることを指定するぜ。
L
気が向いたらね。。。
変換指定子(conversion specifier)
A conversion specifier character that specifies the type of conversion to be applied.
適応される変換タイプを指定する変換指定子文字。
変換指定子
英語内容 適当翻訳
d i
The int argument is converted to signed decimal in the style [−]dddd. The precision specifies the minimum number of digits to appear; if the value being converted can be represented in fewer digits, it is expanded with leading zeros. The default precision is 1. The result of converting a zero value with a precision of zero is no characters. int引数が[-]ddddの形で符号付き10進数に変換されるぜ。精度は最小桁数を指定するぜ。変換される値が精度より少ない桁数なら、0で拡張される。デフォルトの精度は1だぜ。精度0で値0を変換したら文字は無くなっちゃうぜ。
o u x X
The unsigned int argument is converted to unsigned octal (o), unsigned decimal (u), or unsigned hexadecimal notation (x or X) in the style dddd; the letters abcdef are used for x conversion and the letters ABCDEF for X conversion. The precision specifies the minimum number of digits to appear; if the value being converted can be represented in fewer digits, it is expanded with leading zeros. The default precision is 1. The result of converting a zero value with a precision of zero is no characters. unsigned int引数が符号無し8進数表記に(o)、符号無し10進数表記に(u)、または符号無し16進数表記に(xかX)、dddd形式で変換されるぜ。文字abcdefがx変換指定子では使われて、文字ABCDEFがX変換指定子では使われるぞ。精度は最小桁数を指定するよ。変換される値がより少ない桁数で表されるならば、先頭0で拡張されるぜ。デフォルトの精度は1や。精度0で値0を変換したら文字は無いぜよ。
f F
気が向いたらね。
e E
気が向いたらね。。
g G
気が向いたらね。。。
a A
気が向いたらね。。。。
c
If no l length modifier is present, the int argument is converted to an unsigned char, and the resulting character is written. If an l length modifier is present, the wint_t argument is converted as if by an ls conversion specification with no precision and an argument that points to the initial element of a two-element array of wchar_t, the first element containing the wint_t argument to the lc conversion specification and the second a null wide character. 長さ修飾子lが指定されないなら、int引数がunsigned charに変換されて、その結果の文字が書かれるよ。長さ修飾子lが指定されるなら、精度無しでwchar_tの2要素配列(最初の要素はlc変換指定へのwint_t引数を含み、二つ目の要素はnullワイド文字を含む)の先頭を指し示す引数を持つls変換指定のように、wint_t引数が変換されるぜ。
s
If no l length modifier is present, the argument shall be a pointer to the initial element of an array of character type. Characters from the array are written up to (but not including) the terminating null character. If the precision is specified, no more than that many bytes are written. If the precision is not specified or is greater than the size of the array, the array shall contain a null character. If an l length modifier is present, the argument shall be a pointer to the initial element of an array of wchar_t type. Wide characters from the array are converted to multibyte characters (each as if by a call to the wcrtomb function, with the conversion state described by an mbstate_t object initialized to zero before the first wide character is converted) up to and including a terminating null wide character. The resulting multibyte characters are written up to (but not including) the terminating null character(byte). If no precision is specified, the array shall contain a null wide character. If a precision is specified, no more than that many bytes are written (including shift sequences, if any), and the array shall contain a null wide character if, to equal the multibyte character sequence length given by the precision, the function would need to access a wide character one past the end of the array. In no case is a partial multibyte character written. 長さ修飾子lが指定されないなら、引数はchar型配列の先頭ポインタでなければならない。配列から文字達は終端null文字まで書かれる(けどnull文字は書かれないよ)。精度が指定されるなら、精度以上のバイトは書かれない。精度が指定されないか精度が配列サイズより大きければ、配列はnull文字を含むべきだ。長さ修飾子が指定されるなら、引数は、wchar_t型配列の先頭ポインタであるべきだ。配列からワイド文字は終端nullワイド文字を含むまでマルチバイト文字に(それぞれ、wcrtomb関数呼び出しによる様に、mbstate_tオブジェクト(最初のワイド文字が変換される前に0に初期化される)によって記述される変換状態で)変換される。(以下略。。。疲れた。。。)
p
The argument shall be a pointer to void. The value of the pointer is converted to a sequence of printing characters, in an implementation-defined manner. 引数はvoidポインタであるべきやね。ポインタ値は実装で定義される方法で一連の表示文字に変換されるわ。
n
気が向いたらね。。。。。
%
A % character is written. No argument is converted. The complete conversion specification shall be %%. %文字が書かれる。変換される引数はないっす。完ペキな変換指定は%%であるべきっす。
note
a field width, or precision, or both, may be indicated by an asterisk. In this case, an int argument supplies the field width or precision. The arguments specifying field width, or precision, or both, shall appear (in that order) before the argument (if any) to be converted. A negative field width argument is taken as a - flag followed by a positive field width. A negative precision argument is taken as if the precision were omitted.
# This file holds shared secrets or RSA private keys for authentication.
# RSA private key for this host, authenticating it to any other host
# which knows the public part.
# this file is managed with debconf and will contain the automatically created private key
include /var/lib/strongswan/ipsec.secrets.inc
ここに事前共通鍵の設定を追加。sample-keyはなんか適当に変える様に。
: PSK "sample-key"
l2tpを設定する
まず、/etc/xl2tpd/xl2tpd.confを下記のように設定。
[lns default]
name = l2tp
ip range = 192.168.1.200-192.168.1.254
local ip = 192.168.1.2
length bit = yes
refuse pap = yes
refuse chap = yes
require authentication = yes
pppoptfile = /etc/ppp/options.l2tpd.lns
name
認証に使用する名前。ppp設定時のnameと関連付ける(確か)
ip range
接続してきたユーザに設定するIPアドレス
local ip
サーバのローカルIPアドレス
length bit
l2tpヘッダのlengthフィールド有無の設定(かな?)
refuse pap
PAPの使用拒否
refuse chap
CHAPの使用拒否
pppを設定する
次に/etc/ppp/options.l2tpd.lnsを下記のように設定。
name l2tp
refuse-pap
refuse-chap
refuse-mschap
require-mschap-v2
nodefaultroute
lock
nobsdcomp
mtu 1280
mru 1280
logfile /var/log/xl2tpd.log
name
認証時に使用する名前(らしい)
refuse-pap
PAPの使用を許可しない。
refuse-chap
CHAPの使用を許可しない。
refuse-mschap
MS-CHAPの使用を許可しない。
refuse-mschap-v2
MS-CHAPv2による自己証明を要求する。
nodefaultroute
ユーザにデフォルト経路を作成させない。
lock
排他アクセスを確実に行うために、ロックファイルを作成する。(良く分かってない…)
nobsdcomp
パケットのBSD-Compress圧縮を無効にする。
mtu
MTU値の設定。
mru
ネゴシエーション時のMRU値
logfile
ログファイルのパス
次に/etc/ppp/chap-secretsを下記のように設定。
# Secrets for authentication using CHAP
# client server secret IP addresses
"username" * "password" *
これで、usernameとpasswordでログインとなる。
カーネルパラメータを設定する
次に/etc/sysctl.confの下記行のコメントアウトを解除。
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1
ipv4のパケット転送を有効にする。
設定を反映する
下記コマンドで必要なデーモンの再起動を実施。
$ sudo service strongswan restart
$ sudo service xl2tpd restart
$ sudo sysctl -p
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug enp0s13
iface enp0s13 inet dhcp