af_mpls.c (ecb41832bd2a7a3f8ac93527cec5e51e3827daed) af_mpls.c (eec4844fae7c033a0c1fc1eb3b8517aeb8b6cc49)
1// SPDX-License-Identifier: GPL-2.0-only
2#include <linux/types.h>
3#include <linux/skbuff.h>
4#include <linux/socket.h>
5#include <linux/sysctl.h>
6#include <linux/net.h>
7#include <linux/module.h>
8#include <linux/if_arp.h>

--- 23 unchanged lines hidden (view full) ---

32
33/* Maximum number of labels to look ahead at when selecting a path of
34 * a multipath route
35 */
36#define MAX_MP_SELECT_LABELS 4
37
38#define MPLS_NEIGH_TABLE_UNSPEC (NEIGH_LINK_TABLE + 1)
39
1// SPDX-License-Identifier: GPL-2.0-only
2#include <linux/types.h>
3#include <linux/skbuff.h>
4#include <linux/socket.h>
5#include <linux/sysctl.h>
6#include <linux/net.h>
7#include <linux/module.h>
8#include <linux/if_arp.h>

--- 23 unchanged lines hidden (view full) ---

32
33/* Maximum number of labels to look ahead at when selecting a path of
34 * a multipath route
35 */
36#define MAX_MP_SELECT_LABELS 4
37
38#define MPLS_NEIGH_TABLE_UNSPEC (NEIGH_LINK_TABLE + 1)
39
40static int zero = 0;
41static int one = 1;
42static int label_limit = (1 << 20) - 1;
43static int ttl_max = 255;
44
45#if IS_ENABLED(CONFIG_NET_IP_TUNNEL)
46static size_t ipgre_mpls_encap_hlen(struct ip_tunnel_encap *e)
47{
48 return sizeof(struct mpls_shim_hdr);
49}

--- 2552 unchanged lines hidden (view full) ---

2602 struct net *net = table->data;
2603 int platform_labels = net->mpls.platform_labels;
2604 int ret;
2605 struct ctl_table tmp = {
2606 .procname = table->procname,
2607 .data = &platform_labels,
2608 .maxlen = sizeof(int),
2609 .mode = table->mode,
40static int label_limit = (1 << 20) - 1;
41static int ttl_max = 255;
42
43#if IS_ENABLED(CONFIG_NET_IP_TUNNEL)
44static size_t ipgre_mpls_encap_hlen(struct ip_tunnel_encap *e)
45{
46 return sizeof(struct mpls_shim_hdr);
47}

--- 2552 unchanged lines hidden (view full) ---

2600 struct net *net = table->data;
2601 int platform_labels = net->mpls.platform_labels;
2602 int ret;
2603 struct ctl_table tmp = {
2604 .procname = table->procname,
2605 .data = &platform_labels,
2606 .maxlen = sizeof(int),
2607 .mode = table->mode,
2610 .extra1 = &zero,
2608 .extra1 = SYSCTL_ZERO,
2611 .extra2 = &label_limit,
2612 };
2613
2614 ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);
2615
2616 if (write && ret == 0)
2617 ret = resize_platform_label_table(net, platform_labels);
2618

--- 12 unchanged lines hidden (view full) ---

2631 .proc_handler = mpls_platform_labels,
2632 },
2633 {
2634 .procname = "ip_ttl_propagate",
2635 .data = MPLS_NS_SYSCTL_OFFSET(mpls.ip_ttl_propagate),
2636 .maxlen = sizeof(int),
2637 .mode = 0644,
2638 .proc_handler = proc_dointvec_minmax,
2609 .extra2 = &label_limit,
2610 };
2611
2612 ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);
2613
2614 if (write && ret == 0)
2615 ret = resize_platform_label_table(net, platform_labels);
2616

--- 12 unchanged lines hidden (view full) ---

2629 .proc_handler = mpls_platform_labels,
2630 },
2631 {
2632 .procname = "ip_ttl_propagate",
2633 .data = MPLS_NS_SYSCTL_OFFSET(mpls.ip_ttl_propagate),
2634 .maxlen = sizeof(int),
2635 .mode = 0644,
2636 .proc_handler = proc_dointvec_minmax,
2639 .extra1 = &zero,
2640 .extra2 = &one,
2637 .extra1 = SYSCTL_ZERO,
2638 .extra2 = SYSCTL_ONE,
2641 },
2642 {
2643 .procname = "default_ttl",
2644 .data = MPLS_NS_SYSCTL_OFFSET(mpls.default_ttl),
2645 .maxlen = sizeof(int),
2646 .mode = 0644,
2647 .proc_handler = proc_dointvec_minmax,
2639 },
2640 {
2641 .procname = "default_ttl",
2642 .data = MPLS_NS_SYSCTL_OFFSET(mpls.default_ttl),
2643 .maxlen = sizeof(int),
2644 .mode = 0644,
2645 .proc_handler = proc_dointvec_minmax,
2648 .extra1 = &one,
2646 .extra1 = SYSCTL_ONE,
2649 .extra2 = &ttl_max,
2650 },
2651 { }
2652};
2653
2654static int mpls_net_init(struct net *net)
2655{
2656 struct ctl_table *table;

--- 126 unchanged lines hidden ---
2647 .extra2 = &ttl_max,
2648 },
2649 { }
2650};
2651
2652static int mpls_net_init(struct net *net)
2653{
2654 struct ctl_table *table;

--- 126 unchanged lines hidden ---