Guest User

Disable UDP Lite - method 1

a guest
Jun 15th, 2026
73
0
320 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.39 KB | Science | 0 0
  1. diff '--color=auto' -r -u20 a/net/socket.c b/net/socket.c
  2. --- a/net/socket.c  2026-06-09 13:28:53.000000000 +0300
  3. +++ b/net/socket.c  2026-06-15 15:22:33.020499207 +0300
  4. @@ -1529,40 +1529,42 @@
  5.   * Returns 0 or an error. On failure @res is set to %NULL. @kern must
  6.   * be set to true if the socket resides in kernel space.
  7.   * This function internally uses GFP_KERNEL.
  8.   */
  9.  
  10.  int __sock_create(struct net *net, int family, int type, int protocol,
  11.              struct socket **res, int kern)
  12.  {
  13.     int err;
  14.     struct socket *sock;
  15.     const struct net_proto_family *pf;
  16.  
  17.     /*
  18.      *      Check protocol is in range
  19.      */
  20.     if (family < 0 || family >= NPROTO)
  21.         return -EAFNOSUPPORT;
  22.     if (type < 0 || type >= SOCK_MAX)
  23.         return -EINVAL;
  24.  
  25. +   if (   ((family == AF_INET) || (family == AF_INET6)) && (protocol == IPPROTO_UDPLITE)   ) { return -EPERM; }
  26. +
  27.     /* Compatibility.
  28.  
  29.        This uglymoron is moved from INET layer to here to avoid
  30.        deadlock in module load.
  31.      */
  32.     if (family == PF_INET && type == SOCK_PACKET) {
  33.         pr_info_once("%s uses obsolete (PF_INET,SOCK_PACKET)\n",
  34.                  current->comm);
  35.         family = PF_PACKET;
  36.     }
  37.  
  38.     err = security_socket_create(family, type, protocol, kern);
  39.     if (err)
  40.         return err;
  41.  
  42.     /*
  43.      *  Allocate the socket and allow the family to set things up. if
  44.      *  the protocol is 0, the family is instructed to select an appropriate
  45.      *  default.
  46.      */
  47.  
Advertisement
Add Comment
Please, Sign In to add comment