eBPFDevSecTools/opened

Handle duplicate function definitions in .c files guarded by macro guards

palanik1 opened this issue · 0 comments

Is your feature request related to a problem? Please describe.
Consider sock4_update_revnat in cilium/bpf_sock.c defined at line numbers 168 and 193 in the same file. Currently, the developer has to pick one. By default, if there are multiple defs, we process the first definition.
Three alternatives are:

  1. Possibly alert developer and exit processing.
  2. Pick first defn as current practice
  3. Pick all definitions and protect with macro guards. In principle this should work, since this is already done while extracting functions.

This is not an issue with .h files, since we include them as is. I think the single function definition requirement matters only when there are multiple defns across different files.