901-debloat_sock_diag.patch 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. --- a/net/Kconfig
  2. +++ b/net/Kconfig
  3. @@ -92,6 +92,9 @@ source "net/netlabel/Kconfig"
  4. endif # if INET
  5. +config SOCK_DIAG
  6. + bool
  7. +
  8. config NETWORK_SECMARK
  9. bool "Security Marking"
  10. help
  11. --- a/net/core/Makefile
  12. +++ b/net/core/Makefile
  13. @@ -9,8 +9,9 @@ obj-$(CONFIG_SYSCTL) += sysctl_net_core.
  14. obj-y += dev.o ethtool.o dev_addr_lists.o dst.o netevent.o \
  15. neighbour.o rtnetlink.o utils.o link_watch.o filter.o \
  16. - sock_diag.o dev_ioctl.o tso.o
  17. + dev_ioctl.o tso.o
  18. +obj-$(CONFIG_SOCK_DIAG) += sock_diag.o
  19. obj-$(CONFIG_XFRM) += flow.o
  20. obj-y += net-sysfs.o
  21. obj-$(CONFIG_PROC_FS) += net-procfs.o
  22. --- a/net/core/sock.c
  23. +++ b/net/core/sock.c
  24. @@ -1474,9 +1474,11 @@ void sk_destruct(struct sock *sk)
  25. static void __sk_free(struct sock *sk)
  26. {
  27. +#ifdef CONFIG_SOCK_DIAG
  28. if (unlikely(sock_diag_has_destroy_listeners(sk) && sk->sk_net_refcnt))
  29. sock_diag_broadcast_destroy(sk);
  30. else
  31. +#endif
  32. sk_destruct(sk);
  33. }
  34. --- a/net/ipv4/Kconfig
  35. +++ b/net/ipv4/Kconfig
  36. @@ -414,6 +414,7 @@ config INET_LRO
  37. config INET_DIAG
  38. tristate "INET: socket monitoring interface"
  39. + select SOCK_DIAG
  40. default y
  41. ---help---
  42. Support for INET (TCP, DCCP, etc) socket monitoring interface used by
  43. --- a/net/unix/Kconfig
  44. +++ b/net/unix/Kconfig
  45. @@ -22,6 +22,7 @@ config UNIX
  46. config UNIX_DIAG
  47. tristate "UNIX: socket monitoring interface"
  48. depends on UNIX
  49. + select SOCK_DIAG
  50. default n
  51. ---help---
  52. Support for UNIX socket monitoring interface used by the ss tool.
  53. --- a/net/netlink/Kconfig
  54. +++ b/net/netlink/Kconfig
  55. @@ -4,6 +4,7 @@
  56. config NETLINK_DIAG
  57. tristate "NETLINK: socket monitoring interface"
  58. + select SOCK_DIAG
  59. default n
  60. ---help---
  61. Support for NETLINK socket monitoring interface used by the ss tool.
  62. --- a/net/packet/Kconfig
  63. +++ b/net/packet/Kconfig
  64. @@ -18,6 +18,7 @@ config PACKET
  65. config PACKET_DIAG
  66. tristate "Packet: sockets monitoring interface"
  67. depends on PACKET
  68. + select SOCK_DIAG
  69. default n
  70. ---help---
  71. Support for PF_PACKET sockets monitoring interface used by the ss tool.