← Documents Documentation/networking/ipsec.rst GitHub 원문 ↗

Linux 6.18.37 · Networking

IPsec

IPComp 비팽창 정책 때문에 작은 packet이 XFRM policy check에서 폐기되는 예외와 우회책을 설명합니다.

Source pathDocumentation/networking/ipsec.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

ipsec.rst:1-46

IPComp는 압축 결과가 원본보다 작지 않으면 packet을 평문으로 보내야 합니다. 그러나 수신 IPsec policy는 XFRM security path가 없는 평문 packet을 거부할 수 있어 작은 payload만 통신이 실패하는 현상이 생깁니다.

IPComp 예외
작은 IP packet압축 시 비팽창 조건 불충족IPComp header 없이 전송수신 selector 일치XFRM security path 없음policy 폐기

작은 packet이 폐기되는 경로입니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 =====
4 IPsec
5 =====
6
7
8 Here documents known IPsec corner cases which need to be keep in mind when
9 deploy various IPsec configuration in real world production environment.
10
11 1. IPcomp:
12 Small IP packet won't get compressed at sender, and failed on
13 policy check on receiver.
14
15 Quote from RFC3173::
16
17 2.2. Non-Expansion Policy
18
19 If the total size of a compressed payload and the IPComp header, as
20 defined in section 3, is not smaller than the size of the original
21 payload, the IP datagram MUST be sent in the original non-compressed
22 form. To clarify: If an IP datagram is sent non-compressed, no
23
24 IPComp header is added to the datagram. This policy ensures saving
25 the decompression processing cycles and avoiding incurring IP
26 datagram fragmentation when the expanded datagram is larger than the
27 MTU.
28
29 Small IP datagrams are likely to expand as a result of compression.
30 Therefore, a numeric threshold should be applied before compression,
31 where IP datagrams of size smaller than the threshold are sent in the
32 original form without attempting compression. The numeric threshold
33 is implementation dependent.
34
35 Current IPComp implementation is indeed by the book, while as in practice
36 when sending non-compressed packet to the peer (whether or not packet len
37 is smaller than the threshold or the compressed len is larger than original
38 packet len), the packet is dropped when checking the policy as this packet
39 matches the selector but not coming from any XFRM layer, i.e., with no
40 security path. Such naked packet will not eventually make it to upper layer.
41 The result is much more wired to the user when ping peer with different
42 payload length.
43
44 One workaround is try to set "level use" for each policy if user observed
45 above scenario. The consequence of doing so is small packet(uncompressed)
46 will skip policy checking on receiver side.
47

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

실환경에서 주의할 IPsec 예외

1-10

이 문서는 production 환경에서 여러 IPsec 구성을 배포할 때 기억해야 할 알려진 corner case를 기록합니다. 현재 다루는 사례는 IPComp를 쓴 policy와 압축되지 않은 작은 packet의 상호작용입니다.

.. SPDX-License-Identifier: GPL-2.0

=====
IPsec
=====


Here documents known IPsec corner cases which need to be keep in mind when
deploy various IPsec configuration in real world production environment.

IPComp 비팽창 정책

11-34

RFC 3173의 Non-Expansion Policy에 따르면 압축 payload와 IPComp header의 합이 원 payload보다 작지 않으면 datagram을 압축하지 않고 원형으로 보내야 하며 IPComp header도 붙이지 않습니다. 불필요한 decompression 비용과 압축 결과가 MTU보다 커져 생기는 fragmentation을 피하기 위한 규칙입니다.

작은 datagram은 압축하면 오히려 커질 가능성이 높으므로 구현별 numeric threshold보다 작은 packet은 압축을 시도하지 않고 그대로 보내야 합니다.

1. IPcomp:
           Small IP packet won't get compressed at sender, and failed on
           policy check on receiver.

Quote from RFC3173::

  2.2. Non-Expansion Policy

   If the total size of a compressed payload and the IPComp header, as
   defined in section 3, is not smaller than the size of the original
   payload, the IP datagram MUST be sent in the original non-compressed
   form.  To clarify: If an IP datagram is sent non-compressed, no

   IPComp header is added to the datagram.  This policy ensures saving
   the decompression processing cycles and avoiding incurring IP
   datagram fragmentation when the expanded datagram is larger than the
   MTU.

   Small IP datagrams are likely to expand as a result of compression.
   Therefore, a numeric threshold should be applied before compression,
   where IP datagrams of size smaller than the threshold are sent in the
   original form without attempting compression.  The numeric threshold
   is implementation dependent.

수신 policy 실패와 우회책

35-46

Linux IPComp 구현은 이 규칙을 따르지만 실사용에서는 작은 packet이나 압축 후 더 커진 packet이 평문으로 전송될 때 문제가 생깁니다. 수신 packet은 selector에는 일치하지만 XFRM layer를 통과한 security path가 없어서 policy check에서 폐기되고 upper layer에 도달하지 않습니다. payload 길이를 바꿔 ping할 때 일부 크기만 실패하는 형태로 보여 특히 혼란스럽습니다.

이 현상을 확인했다면 각 policy의 level을 `use`로 설정하는 것이 한 가지 우회책입니다. 그러면 압축되지 않은 작은 packet은 수신 측 policy 검사를 건너뛸 수 있으므로 보안 요구사항과 tradeoff를 검토해야 합니다.

Current IPComp implementation is indeed by the book, while as in practice
when sending non-compressed packet to the peer (whether or not packet len
is smaller than the threshold or the compressed len is larger than original
packet len), the packet is dropped when checking the policy as this packet
matches the selector but not coming from any XFRM layer, i.e., with no
security path. Such naked packet will not eventually make it to upper layer.
The result is much more wired to the user when ping peer with different
payload length.

One workaround is try to set "level use" for each policy if user observed
above scenario. The consequence of doing so is small packet(uncompressed)
will skip policy checking on receiver side.