Commit c7852387 authored by Brenden Blanco's avatar Brenden Blanco

Remove BPF_LL_OFF usage

Signed-off-by: default avatarBrenden Blanco <bblanco@plumgrid.com>
parent b07dab8c
...@@ -202,7 +202,7 @@ bool BTypeVisitor::VisitImplicitCastExpr(ImplicitCastExpr *E) { ...@@ -202,7 +202,7 @@ bool BTypeVisitor::VisitImplicitCastExpr(ImplicitCastExpr *E) {
uint64_t ofs = C.getFieldOffset(F); uint64_t ofs = C.getFieldOffset(F);
uint64_t sz = F->isBitField() ? F->getBitWidthValue(C) : C.getTypeSize(F->getType()); uint64_t sz = F->isBitField() ? F->getBitWidthValue(C) : C.getTypeSize(F->getType());
string base = rewriter_.getRewrittenText(SourceRange(Base->getLocStart(), Base->getLocEnd())); string base = rewriter_.getRewrittenText(SourceRange(Base->getLocStart(), Base->getLocEnd()));
string text = "bpf_dext_pkt(skb, _parse_base + (u64)" + base + "+" + to_string(ofs >> 3) string text = "bpf_dext_pkt(skb, (u64)" + base + "+" + to_string(ofs >> 3)
+ ", " + to_string(ofs & 0x7) + ", " + to_string(sz) + ")"; + ", " + to_string(ofs & 0x7) + ", " + to_string(sz) + ")";
rewriter_.ReplaceText(SourceRange(E->getLocStart(), E->getLocEnd()), text); rewriter_.ReplaceText(SourceRange(E->getLocStart(), E->getLocEnd()), text);
} }
......
...@@ -47,7 +47,6 @@ struct _name##_table_t _name ...@@ -47,7 +47,6 @@ struct _name##_table_t _name
BPF_EXPORT(name) int _##name(struct __sk_buff *skb) BPF_EXPORT(name) int _##name(struct __sk_buff *skb)
#define BEGIN(next) \ #define BEGIN(next) \
u64 _parse_cursor = 0; \ u64 _parse_cursor = 0; \
u64 _parse_base = skb->pkt_type == PACKET_OUTGOING ? 0 : BPF_LL_OFF; \
goto next goto next
#define PROTO(name) \ #define PROTO(name) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment