• Dmitry Yakunin's avatar
    inet_diag: add cgroup id attribute · 6e3a401f
    Dmitry Yakunin authored
    This patch adds cgroup v2 ID to common inet diag message attributes.
    Cgroup v2 ID is kernfs ID (ino or ino+gen). This attribute allows filter
    inet diag output by cgroup ID obtained by name_to_handle_at() syscall.
    When net_cls or net_prio cgroup is activated this ID is equal to 1 (root
    cgroup ID) for newly created sockets.
    
    Some notes about this ID:
    
    1) gets initialized in socket() syscall
    2) incoming socket gets ID from listening socket
       (not during accept() syscall)
    3) not changed when process get moved to another cgroup
    4) can point to deleted cgroup (refcounting)
    
    v2:
      - use CONFIG_SOCK_CGROUP_DATA instead if CONFIG_CGROUPS
    
    v3:
      - fix attr size by using nla_total_size_64bit() (Eric Dumazet)
      - more detailed commit message (Konstantin Khlebnikov)
    Signed-off-by: default avatarDmitry Yakunin <zeil@yandex-team.ru>
    Reviewed-by: default avatarKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
    Acked-By: default avatarTejun Heo <tj@kernel.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    6e3a401f
inet_diag.c 32.9 KB