rtnetlink.c (b0ad3c179059089d809b477a1d445c1183a7b8fe) | rtnetlink.c (fef5b228dd38378148bc850f7e69a7783f3b95a4) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * INET An implementation of the TCP/IP protocol suite for the LINUX 4 * operating system. INET is implemented using the BSD Socket 5 * interface as the means of communication with the user level. 6 * 7 * Routing netlink socket interface: protocol independent part. 8 * --- 2371 unchanged lines hidden (view full) --- 2380 if (dev) { 2381 if (tb[IFLA_ADDRESS] && 2382 nla_len(tb[IFLA_ADDRESS]) < dev->addr_len) 2383 return -EINVAL; 2384 2385 if (tb[IFLA_BROADCAST] && 2386 nla_len(tb[IFLA_BROADCAST]) < dev->addr_len) 2387 return -EINVAL; | 1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * INET An implementation of the TCP/IP protocol suite for the LINUX 4 * operating system. INET is implemented using the BSD Socket 5 * interface as the means of communication with the user level. 6 * 7 * Routing netlink socket interface: protocol independent part. 8 * --- 2371 unchanged lines hidden (view full) --- 2380 if (dev) { 2381 if (tb[IFLA_ADDRESS] && 2382 nla_len(tb[IFLA_ADDRESS]) < dev->addr_len) 2383 return -EINVAL; 2384 2385 if (tb[IFLA_BROADCAST] && 2386 nla_len(tb[IFLA_BROADCAST]) < dev->addr_len) 2387 return -EINVAL; |
2388 2389 if (tb[IFLA_GSO_MAX_SIZE] && 2390 nla_get_u32(tb[IFLA_GSO_MAX_SIZE]) > dev->tso_max_size) { 2391 NL_SET_ERR_MSG(extack, "too big gso_max_size"); 2392 return -EINVAL; 2393 } 2394 2395 if (tb[IFLA_GSO_MAX_SEGS] && 2396 (nla_get_u32(tb[IFLA_GSO_MAX_SEGS]) > GSO_MAX_SEGS || 2397 nla_get_u32(tb[IFLA_GSO_MAX_SEGS]) > dev->tso_max_segs)) { 2398 NL_SET_ERR_MSG(extack, "too big gso_max_segs"); 2399 return -EINVAL; 2400 } 2401 2402 if (tb[IFLA_GSO_IPV4_MAX_SIZE] && 2403 nla_get_u32(tb[IFLA_GSO_IPV4_MAX_SIZE]) > dev->tso_max_size) { 2404 NL_SET_ERR_MSG(extack, "too big gso_ipv4_max_size"); 2405 return -EINVAL; 2406 } |
|
2388 } 2389 2390 if (tb[IFLA_AF_SPEC]) { 2391 struct nlattr *af; 2392 int rem, err; 2393 2394 nla_for_each_nested(af, tb[IFLA_AF_SPEC], rem) { 2395 const struct rtnl_af_ops *af_ops; --- 457 unchanged lines hidden (view full) --- 2853 if (err) 2854 goto errout; 2855 status |= DO_SETLINK_MODIFIED; 2856 } 2857 2858 if (tb[IFLA_GSO_MAX_SIZE]) { 2859 u32 max_size = nla_get_u32(tb[IFLA_GSO_MAX_SIZE]); 2860 | 2407 } 2408 2409 if (tb[IFLA_AF_SPEC]) { 2410 struct nlattr *af; 2411 int rem, err; 2412 2413 nla_for_each_nested(af, tb[IFLA_AF_SPEC], rem) { 2414 const struct rtnl_af_ops *af_ops; --- 457 unchanged lines hidden (view full) --- 2872 if (err) 2873 goto errout; 2874 status |= DO_SETLINK_MODIFIED; 2875 } 2876 2877 if (tb[IFLA_GSO_MAX_SIZE]) { 2878 u32 max_size = nla_get_u32(tb[IFLA_GSO_MAX_SIZE]); 2879 |
2861 if (max_size > dev->tso_max_size) { 2862 err = -EINVAL; 2863 goto errout; 2864 } 2865 | |
2866 if (dev->gso_max_size ^ max_size) { 2867 netif_set_gso_max_size(dev, max_size); 2868 status |= DO_SETLINK_MODIFIED; 2869 } 2870 } 2871 2872 if (tb[IFLA_GSO_MAX_SEGS]) { 2873 u32 max_segs = nla_get_u32(tb[IFLA_GSO_MAX_SEGS]); 2874 | 2880 if (dev->gso_max_size ^ max_size) { 2881 netif_set_gso_max_size(dev, max_size); 2882 status |= DO_SETLINK_MODIFIED; 2883 } 2884 } 2885 2886 if (tb[IFLA_GSO_MAX_SEGS]) { 2887 u32 max_segs = nla_get_u32(tb[IFLA_GSO_MAX_SEGS]); 2888 |
2875 if (max_segs > GSO_MAX_SEGS || max_segs > dev->tso_max_segs) { 2876 err = -EINVAL; 2877 goto errout; 2878 } 2879 | |
2880 if (dev->gso_max_segs ^ max_segs) { 2881 netif_set_gso_max_segs(dev, max_segs); 2882 status |= DO_SETLINK_MODIFIED; 2883 } 2884 } 2885 2886 if (tb[IFLA_GRO_MAX_SIZE]) { 2887 u32 gro_max_size = nla_get_u32(tb[IFLA_GRO_MAX_SIZE]); 2888 2889 if (dev->gro_max_size ^ gro_max_size) { 2890 netif_set_gro_max_size(dev, gro_max_size); 2891 status |= DO_SETLINK_MODIFIED; 2892 } 2893 } 2894 2895 if (tb[IFLA_GSO_IPV4_MAX_SIZE]) { 2896 u32 max_size = nla_get_u32(tb[IFLA_GSO_IPV4_MAX_SIZE]); 2897 | 2889 if (dev->gso_max_segs ^ max_segs) { 2890 netif_set_gso_max_segs(dev, max_segs); 2891 status |= DO_SETLINK_MODIFIED; 2892 } 2893 } 2894 2895 if (tb[IFLA_GRO_MAX_SIZE]) { 2896 u32 gro_max_size = nla_get_u32(tb[IFLA_GRO_MAX_SIZE]); 2897 2898 if (dev->gro_max_size ^ gro_max_size) { 2899 netif_set_gro_max_size(dev, gro_max_size); 2900 status |= DO_SETLINK_MODIFIED; 2901 } 2902 } 2903 2904 if (tb[IFLA_GSO_IPV4_MAX_SIZE]) { 2905 u32 max_size = nla_get_u32(tb[IFLA_GSO_IPV4_MAX_SIZE]); 2906 |
2898 if (max_size > dev->tso_max_size) { 2899 err = -EINVAL; 2900 goto errout; 2901 } 2902 | |
2903 if (dev->gso_ipv4_max_size ^ max_size) { 2904 netif_set_gso_ipv4_max_size(dev, max_size); 2905 status |= DO_SETLINK_MODIFIED; 2906 } 2907 } 2908 2909 if (tb[IFLA_GRO_IPV4_MAX_SIZE]) { 2910 u32 gro_max_size = nla_get_u32(tb[IFLA_GRO_IPV4_MAX_SIZE]); --- 3621 unchanged lines hidden --- | 2907 if (dev->gso_ipv4_max_size ^ max_size) { 2908 netif_set_gso_ipv4_max_size(dev, max_size); 2909 status |= DO_SETLINK_MODIFIED; 2910 } 2911 } 2912 2913 if (tb[IFLA_GRO_IPV4_MAX_SIZE]) { 2914 u32 gro_max_size = nla_get_u32(tb[IFLA_GRO_IPV4_MAX_SIZE]); --- 3621 unchanged lines hidden --- |