~ubuntu-branches/ubuntu/quantal/linux-linaro-mx51/quantal

« back to all changes in this revision

Viewing changes to net/ipv4/sysctl_net_ipv4.c

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-3o58a3c1bj7x00rs
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
#include <linux/seqlock.h>
14
14
#include <linux/init.h>
15
15
#include <linux/slab.h>
 
16
#include <linux/nsproxy.h>
16
17
#include <net/snmp.h>
17
18
#include <net/icmp.h>
18
19
#include <net/ip.h>
21
22
#include <net/udp.h>
22
23
#include <net/cipso_ipv4.h>
23
24
#include <net/inet_frag.h>
 
25
#include <net/ping.h>
24
26
 
25
27
static int zero;
26
28
static int tcp_retr1_max = 255;
30
32
static int tcp_adv_win_scale_max = 31;
31
33
static int ip_ttl_min = 1;
32
34
static int ip_ttl_max = 255;
 
35
static int ip_ping_group_range_min[] = { 0, 0 };
 
36
static int ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX };
33
37
 
34
38
/* Update system visible IP port range */
35
39
static void set_local_port_range(int range[2])
68
72
        return ret;
69
73
}
70
74
 
 
75
 
 
76
void inet_get_ping_group_range_table(struct ctl_table *table, gid_t *low, gid_t *high)
 
77
{
 
78
        gid_t *data = table->data;
 
79
        unsigned seq;
 
80
        do {
 
81
                seq = read_seqbegin(&sysctl_local_ports.lock);
 
82
 
 
83
                *low = data[0];
 
84
                *high = data[1];
 
85
        } while (read_seqretry(&sysctl_local_ports.lock, seq));
 
86
}
 
87
 
 
88
/* Update system visible IP port range */
 
89
static void set_ping_group_range(struct ctl_table *table, int range[2])
 
90
{
 
91
        gid_t *data = table->data;
 
92
        write_seqlock(&sysctl_local_ports.lock);
 
93
        data[0] = range[0];
 
94
        data[1] = range[1];
 
95
        write_sequnlock(&sysctl_local_ports.lock);
 
96
}
 
97
 
 
98
/* Validate changes from /proc interface. */
 
99
static int ipv4_ping_group_range(ctl_table *table, int write,
 
100
                                 void __user *buffer,
 
101
                                 size_t *lenp, loff_t *ppos)
 
102
{
 
103
        int ret;
 
104
        gid_t range[2];
 
105
        ctl_table tmp = {
 
106
                .data = &range,
 
107
                .maxlen = sizeof(range),
 
108
                .mode = table->mode,
 
109
                .extra1 = &ip_ping_group_range_min,
 
110
                .extra2 = &ip_ping_group_range_max,
 
111
        };
 
112
 
 
113
        inet_get_ping_group_range_table(table, range, range + 1);
 
114
        ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);
 
115
 
 
116
        if (write && ret == 0)
 
117
                set_ping_group_range(table, range);
 
118
 
 
119
        return ret;
 
120
}
 
121
 
71
122
static int proc_tcp_congestion_control(ctl_table *ctl, int write,
72
123
                                       void __user *buffer, size_t *lenp, loff_t *ppos)
73
124
{
677
728
                .mode           = 0644,
678
729
                .proc_handler   = proc_dointvec
679
730
        },
 
731
        {
 
732
                .procname       = "ping_group_range",
 
733
                .data           = &init_net.ipv4.sysctl_ping_group_range,
 
734
                .maxlen         = sizeof(init_net.ipv4.sysctl_ping_group_range),
 
735
                .mode           = 0644,
 
736
                .proc_handler   = ipv4_ping_group_range,
 
737
        },
680
738
        { }
681
739
};
682
740
 
711
769
                        &net->ipv4.sysctl_icmp_ratemask;
712
770
                table[6].data =
713
771
                        &net->ipv4.sysctl_rt_cache_rebuild_count;
 
772
                table[7].data =
 
773
                        &net->ipv4.sysctl_ping_group_range;
 
774
 
714
775
        }
715
776
 
 
777
        /*
 
778
         * Sane defaults - nobody may create ping sockets.
 
779
         * Boot scripts should set this to distro-specific group.
 
780
         */
 
781
        net->ipv4.sysctl_ping_group_range[0] = 1;
 
782
        net->ipv4.sysctl_ping_group_range[1] = 0;
 
783
 
716
784
        net->ipv4.sysctl_rt_cache_rebuild_count = 4;
717
785
 
718
786
        net->ipv4.ipv4_hdr = register_net_sysctl_table(net,