Skip to content

Commit

Permalink
bpf: add drop reason for TTL exceeded
Browse files Browse the repository at this point in the history
Make the TTL drops from ipv4_l3() more visible.

Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
  • Loading branch information
julianwiedmann committed Jul 21, 2023
1 parent c8ce545 commit 4e9bbcd
Show file tree
Hide file tree
Showing 7 changed files with 179 additions and 169 deletions.
1 change: 1 addition & 0 deletions api/v1/flow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,7 @@ here.
| UNSUPPORTED_PROTOCOL_FOR_DSR_ENCAP | 193 | |
| NO_EGRESS_GATEWAY | 194 | |
| UNENCRYPTED_TRAFFIC | 195 | |
| TTL_EXCEEDED | 196 | |



Expand Down
341 changes: 173 additions & 168 deletions api/v1/flow/flow.pb.go

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions api/v1/flow/flow.proto
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ enum DropReason {
UNSUPPORTED_PROTOCOL_FOR_DSR_ENCAP = 193;
NO_EGRESS_GATEWAY = 194;
UNENCRYPTED_TRAFFIC = 195;
TTL_EXCEEDED = 196;
}

enum TrafficDirection {
Expand Down
1 change: 1 addition & 0 deletions api/v1/observer/observer.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions bpf/lib/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,7 @@ enum {
#define DROP_DSR_ENCAP_UNSUPP_PROTO -193
#define DROP_NO_EGRESS_GATEWAY -194
#define DROP_UNENCRYPTED_TRAFFIC -195
#define DROP_TTL_EXCEEDED -196

#define NAT_PUNT_TO_STACK DROP_NAT_NOT_NEEDED
#define NAT_NEEDED CTX_ACT_OK
Expand Down
2 changes: 1 addition & 1 deletion bpf/lib/l3.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static __always_inline int ipv4_l3(struct __ctx_buff *ctx, int l3_off,
{
if (ipv4_dec_ttl(ctx, l3_off, ip4)) {
/* FIXME: Send ICMP TTL */
return DROP_INVALID;
return DROP_TTL_EXCEEDED;
}

if (smac && eth_store_saddr(ctx, smac, 0) < 0)
Expand Down
1 change: 1 addition & 0 deletions pkg/monitor/api/drop.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ var errors = map[uint8]string{
193: "Unsupported packet protocol for DSR encapsulation",
194: "No egress gateway found",
195: "Traffic is unencrypted",
196: "TTL exceeded",
}

func extendedReason(reason uint8, extError int8) string {
Expand Down

0 comments on commit 4e9bbcd

Please sign in to comment.