ntop / PF_RING

High-speed packet processing framework
http://www.ntop.org
GNU Lesser General Public License v2.1
2.68k stars 353 forks source link

kernel: pf_ring: better define sa_data size #923

Closed Ansuel closed 6 months ago

Ansuel commented 6 months ago

pfring_mod_bind() needs to specify the interface name using struct sockaddr that is defined as

struct sockaddr { ushort sa_family; char sa_data[14]; };

so the total interface name length is 13 chars (plus \0 trailer).

Since sa_data size is arbitrary, define a more precise size for PF_RING socket use.

This fix some compilation error with fortify string and makes the array handling more deterministic.

Please sign (check) the below before submitting the Pull Request:

cardigliano commented 6 months ago

Where is RING_SA_DATA_LEN defined when RING_USE_SOCKADDR_LL is defined?

Ansuel commented 6 months ago

@cardigliano sorry I didn't notice that function was also used by the LL variant. I tested this on previous version where the ifdef wasn't present. Should be good now.