1

I am trying to assign value to struct in6_addr from inside my XDP program. From user space it can be done using

struct in6_addr in6 = {};
inet_pton(AF_INET6, "fc00:dead:cafe:2::1", &in6);

But it seems inet_pton is not available inside eBPF. Is there any BPF helper available for that?

Thank you.

Vikas.Maurya
  • 50
  • 1
  • 6
  • Your `fc00:dead:cafe:2::1` address is misusing ULA. The ULA range is `fc00::/7`, but the first half of the range (`fc00::/8`) is reserved for a global authority. You are allowed to assign addressing in the second half of the range (`fd00::/8`), but the next 40 bits _must_ be randomly assigned, giving you a `/48` prefix from which you get 65,536 standard `/64` networks. – Ron Maupin Aug 30 '21 at 13:15
  • Where are you receiving the string from? I'd expect the kernel to always provide the IPv6 address in non-string format. – pchaigno Aug 30 '21 at 13:59
  • @pchaigno I am trying to change the destination address in ipv6 header with random ipv6 string. This I am doing to test bpf_fib_lookup () to forward packet to that ip address. – Vikas.Maurya Aug 30 '21 at 14:55
  • 1
    If you are passing those string to the program, can't you instead convert them to an array of `__u32` in userspace and compile that array in the C program. That's how we generate programs with specific IPv6 addresses in Cilium. – pchaigno Aug 30 '21 at 16:43

0 Answers0