diff options
Diffstat (limited to 'net/ipv4/ip_fragment.c')
-rw-r--r-- | net/ipv4/ip_fragment.c | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index 52c273ea05c3..b66910aaef4d 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c | |||
@@ -79,40 +79,11 @@ struct ipq { | |||
79 | struct inet_peer *peer; | 79 | struct inet_peer *peer; |
80 | }; | 80 | }; |
81 | 81 | ||
82 | /* RFC 3168 support : | ||
83 | * We want to check ECN values of all fragments, do detect invalid combinations. | ||
84 | * In ipq->ecn, we store the OR value of each ip4_frag_ecn() fragment value. | ||
85 | */ | ||
86 | #define IPFRAG_ECN_NOT_ECT 0x01 /* one frag had ECN_NOT_ECT */ | ||
87 | #define IPFRAG_ECN_ECT_1 0x02 /* one frag had ECN_ECT_1 */ | ||
88 | #define IPFRAG_ECN_ECT_0 0x04 /* one frag had ECN_ECT_0 */ | ||
89 | #define IPFRAG_ECN_CE 0x08 /* one frag had ECN_CE */ | ||
90 | |||
91 | static inline u8 ip4_frag_ecn(u8 tos) | 82 | static inline u8 ip4_frag_ecn(u8 tos) |
92 | { | 83 | { |
93 | return 1 << (tos & INET_ECN_MASK); | 84 | return 1 << (tos & INET_ECN_MASK); |
94 | } | 85 | } |
95 | 86 | ||
96 | /* Given the OR values of all fragments, apply RFC 3168 5.3 requirements | ||
97 | * Value : 0xff if frame should be dropped. | ||
98 | * 0 or INET_ECN_CE value, to be ORed in to final iph->tos field | ||
99 | */ | ||
100 | static const u8 ip4_frag_ecn_table[16] = { | ||
101 | /* at least one fragment had CE, and others ECT_0 or ECT_1 */ | ||
102 | [IPFRAG_ECN_CE | IPFRAG_ECN_ECT_0] = INET_ECN_CE, | ||
103 | [IPFRAG_ECN_CE | IPFRAG_ECN_ECT_1] = INET_ECN_CE, | ||
104 | [IPFRAG_ECN_CE | IPFRAG_ECN_ECT_0 | IPFRAG_ECN_ECT_1] = INET_ECN_CE, | ||
105 | |||
106 | /* invalid combinations : drop frame */ | ||
107 | [IPFRAG_ECN_NOT_ECT | IPFRAG_ECN_CE] = 0xff, | ||
108 | [IPFRAG_ECN_NOT_ECT | IPFRAG_ECN_ECT_0] = 0xff, | ||
109 | [IPFRAG_ECN_NOT_ECT | IPFRAG_ECN_ECT_1] = 0xff, | ||
110 | [IPFRAG_ECN_NOT_ECT | IPFRAG_ECN_ECT_0 | IPFRAG_ECN_ECT_1] = 0xff, | ||
111 | [IPFRAG_ECN_NOT_ECT | IPFRAG_ECN_CE | IPFRAG_ECN_ECT_0] = 0xff, | ||
112 | [IPFRAG_ECN_NOT_ECT | IPFRAG_ECN_CE | IPFRAG_ECN_ECT_1] = 0xff, | ||
113 | [IPFRAG_ECN_NOT_ECT | IPFRAG_ECN_CE | IPFRAG_ECN_ECT_0 | IPFRAG_ECN_ECT_1] = 0xff, | ||
114 | }; | ||
115 | |||
116 | static struct inet_frags ip4_frags; | 87 | static struct inet_frags ip4_frags; |
117 | 88 | ||
118 | int ip_frag_nqueues(struct net *net) | 89 | int ip_frag_nqueues(struct net *net) |
@@ -557,7 +528,7 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *prev, | |||
557 | 528 | ||
558 | ipq_kill(qp); | 529 | ipq_kill(qp); |
559 | 530 | ||
560 | ecn = ip4_frag_ecn_table[qp->ecn]; | 531 | ecn = ip_frag_ecn_table[qp->ecn]; |
561 | if (unlikely(ecn == 0xff)) { | 532 | if (unlikely(ecn == 0xff)) { |
562 | err = -EINVAL; | 533 | err = -EINVAL; |
563 | goto out_fail; | 534 | goto out_fail; |