Skip to content

Commit f8ab60f

Browse files
committed
parsing_helpers: remove dead code
Remove three parsers which are not used anywhere in code. These get_* style helpers were replaced by parse_* style helpers in the following commit: 455cb40 ("packetXX: Switch parsing helpers to parse_TYPE() style functions"). Signed-off-by: Anton Protopopov <a.s.protopopov@gmail.com>
1 parent a6bfd1f commit f8ab60f

File tree

1 file changed

+0
-73
lines changed

1 file changed

+0
-73
lines changed

common/parsing_helpers.h

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -185,77 +185,4 @@ static __always_inline int parse_icmphdr_common(struct hdr_cursor *nh,
185185
return h->type;
186186
}
187187

188-
static __always_inline struct ethhdr *get_ethhdr(struct hdr_cursor *nh,
189-
void *data_end)
190-
{
191-
struct ethhdr *eth = nh->pos;
192-
int hdrsize = sizeof(*eth);
193-
194-
/* Byte-count bounds check; check if current pointer + size of header
195-
* is after data_end.
196-
*/
197-
if (nh->pos + hdrsize > data_end)
198-
return NULL;
199-
200-
nh->pos += hdrsize;
201-
return eth;
202-
}
203-
204-
static __always_inline struct ipv6hdr *get_ip6hdr(struct ethhdr *eth,
205-
struct hdr_cursor *nh,
206-
void *data_end)
207-
{
208-
struct vlan_hdr *vlh = nh->pos;
209-
__u16 h_proto = eth->h_proto;
210-
struct ipv6hdr *ip6h;
211-
int i;
212-
213-
/* Use loop unrolling to avoid the verifier restriction on loops;
214-
* support up to VLAN_MAX_DEPTH layers of VLAN encapsulation.
215-
*/
216-
#pragma unroll
217-
for (i = 0; i < VLAN_MAX_DEPTH; i++) {
218-
if (!(h_proto == bpf_htons(ETH_P_8021Q) ||
219-
h_proto == bpf_htons(ETH_P_8021AD)))
220-
break;
221-
222-
if (vlh + 1 > data_end)
223-
return NULL;
224-
225-
h_proto = vlh->h_vlan_encapsulated_proto;
226-
vlh++;
227-
}
228-
229-
ip6h = (void *)vlh;
230-
231-
if (h_proto != bpf_htons(ETH_P_IPV6))
232-
return NULL;
233-
234-
/* Pointer-arithmetic bounds check; pointer +1 points to after end of
235-
* thing being pointed to. We will be using this style in the remainder
236-
* of the tutorial.
237-
*/
238-
if (ip6h + 1 > data_end)
239-
return NULL;
240-
241-
nh->pos = ip6h + 1;
242-
return ip6h;
243-
}
244-
245-
static __always_inline struct icmp6hdr *get_icmp6hdr(struct ipv6hdr *ip6h,
246-
struct hdr_cursor *nh,
247-
void *data_end)
248-
{
249-
struct icmp6hdr *icmp6h = nh->pos;
250-
251-
if (ip6h->nexthdr != IPPROTO_ICMPV6)
252-
return NULL;
253-
254-
if (icmp6h + 1 > data_end)
255-
return NULL;
256-
257-
nh->pos = icmp6h + 1;
258-
return icmp6h;
259-
}
260-
261188
#endif /* __PARSING_HELPERS_H */

0 commit comments

Comments
 (0)