GithubHelp home page GithubHelp logo

Comments (2)

ti-mo avatar ti-mo commented on July 4, 2024 1

See #578.

This is a characteristic of program arrays. If all userspace references are gone (no more pins/fds), all its entries are removed. In your program, after the call to link.AttachXDP, there are no more references to objs and the runtime is free to collect it and any resources it points to, including all *Maps. *Map has a finalizer that calls Close() on itself when it's collected, causing the underlying fd to be closed, clearing the map.

Your code has two problems:

from ebpf.

vincentmli avatar vincentmli commented on July 4, 2024

sorry to re-open this, I thought maybe I had the program array map defined wrong result in program array map not populated by ebpf-go library, but after I test using https://github.com/vincentmli/XDPeriments/blob/master/Cookies/xdp_dns_cookies_user.c to load same bpf object file, the program array map is populated properly, so I think this has something to do with LoadAndAssign, here is the program array map:

struct {
        __uint(type, BPF_MAP_TYPE_PROG_ARRAY);
        __uint(max_entries, 3);
        __uint(key_size, sizeof(uint32_t));
        __uint(value_size, sizeof(uint32_t));
        __array(values, int (void *));
} jmp_rate_table SEC(".maps") = {
        .values = {
                [DO_RATE_LIMIT_IPV6] = (void *)&xdp_do_rate_limit_ipv6,
                [DO_RATE_LIMIT_IPV4] = (void *)&xdp_do_rate_limit_ipv4,
        },
};

from ebpf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.