aya-rs/book

Update XDP example to match the code generated by 'cargo generate' from template

Closed this issue · 0 comments

Since the template has changed, it would be good to update the "Hello XDP!" example to match the code that is currently generated.

Currently the generated code is larger than the XDP example seems to imply - for example, it has most of the needed use statements and has functions taking ctx: XdpContext.

3.1 says "We'll be using myapp in this example" - the generated code has fn myapp and fn try_myapp while the example talks about xdp_firewall and try_xdp_firewall. If those function names are preferred, maybe worth to instruct the reader: "Rename fn myapp to fn xdp_filewall and the same with the try versions?

Also in the book example the attribute before pub fn xdp_firewall is "just" #[xdp] while the generated code has #[xdp(name="myapp")]...