aboutsummaryrefslogtreecommitdiffstats
path: root/net/rose
diff options
context:
space:
mode:
Diffstat (limited to 'net/rose')
-rw-r--r--net/rose/af_rose.c7
-rw-r--r--net/rose/rose_route.c28
-rw-r--r--net/rose/sysctl_net_rose.c26
3 files changed, 22 insertions, 39 deletions
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index 502cce76621d..8feb9e5d6623 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -512,12 +512,13 @@ static struct proto rose_proto = {
512 .obj_size = sizeof(struct rose_sock), 512 .obj_size = sizeof(struct rose_sock),
513}; 513};
514 514
515static int rose_create(struct net *net, struct socket *sock, int protocol) 515static int rose_create(struct net *net, struct socket *sock, int protocol,
516 int kern)
516{ 517{
517 struct sock *sk; 518 struct sock *sk;
518 struct rose_sock *rose; 519 struct rose_sock *rose;
519 520
520 if (net != &init_net) 521 if (!net_eq(net, &init_net))
521 return -EAFNOSUPPORT; 522 return -EAFNOSUPPORT;
522 523
523 if (sock->type != SOCK_SEQPACKET || protocol != 0) 524 if (sock->type != SOCK_SEQPACKET || protocol != 0)
@@ -1509,7 +1510,7 @@ static const struct file_operations rose_info_fops = {
1509}; 1510};
1510#endif /* CONFIG_PROC_FS */ 1511#endif /* CONFIG_PROC_FS */
1511 1512
1512static struct net_proto_family rose_family_ops = { 1513static const struct net_proto_family rose_family_ops = {
1513 .family = PF_ROSE, 1514 .family = PF_ROSE,
1514 .create = rose_create, 1515 .create = rose_create,
1515 .owner = THIS_MODULE, 1516 .owner = THIS_MODULE,
diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c
index f3e21989b88c..795c4b025e31 100644
--- a/net/rose/rose_route.c
+++ b/net/rose/rose_route.c
@@ -77,8 +77,9 @@ static int __must_check rose_add_node(struct rose_route_struct *rose_route,
77 77
78 rose_neigh = rose_neigh_list; 78 rose_neigh = rose_neigh_list;
79 while (rose_neigh != NULL) { 79 while (rose_neigh != NULL) {
80 if (ax25cmp(&rose_route->neighbour, &rose_neigh->callsign) == 0 80 if (ax25cmp(&rose_route->neighbour,
81 && rose_neigh->dev == dev) 81 &rose_neigh->callsign) == 0 &&
82 rose_neigh->dev == dev)
82 break; 83 break;
83 rose_neigh = rose_neigh->next; 84 rose_neigh = rose_neigh->next;
84 } 85 }
@@ -311,8 +312,9 @@ static int rose_del_node(struct rose_route_struct *rose_route,
311 312
312 rose_neigh = rose_neigh_list; 313 rose_neigh = rose_neigh_list;
313 while (rose_neigh != NULL) { 314 while (rose_neigh != NULL) {
314 if (ax25cmp(&rose_route->neighbour, &rose_neigh->callsign) == 0 315 if (ax25cmp(&rose_route->neighbour,
315 && rose_neigh->dev == dev) 316 &rose_neigh->callsign) == 0 &&
317 rose_neigh->dev == dev)
316 break; 318 break;
317 rose_neigh = rose_neigh->next; 319 rose_neigh = rose_neigh->next;
318 } 320 }
@@ -600,13 +602,13 @@ struct net_device *rose_dev_first(void)
600{ 602{
601 struct net_device *dev, *first = NULL; 603 struct net_device *dev, *first = NULL;
602 604
603 read_lock(&dev_base_lock); 605 rcu_read_lock();
604 for_each_netdev(&init_net, dev) { 606 for_each_netdev_rcu(&init_net, dev) {
605 if ((dev->flags & IFF_UP) && dev->type == ARPHRD_ROSE) 607 if ((dev->flags & IFF_UP) && dev->type == ARPHRD_ROSE)
606 if (first == NULL || strncmp(dev->name, first->name, 3) < 0) 608 if (first == NULL || strncmp(dev->name, first->name, 3) < 0)
607 first = dev; 609 first = dev;
608 } 610 }
609 read_unlock(&dev_base_lock); 611 rcu_read_unlock();
610 612
611 return first; 613 return first;
612} 614}
@@ -618,8 +620,8 @@ struct net_device *rose_dev_get(rose_address *addr)
618{ 620{
619 struct net_device *dev; 621 struct net_device *dev;
620 622
621 read_lock(&dev_base_lock); 623 rcu_read_lock();
622 for_each_netdev(&init_net, dev) { 624 for_each_netdev_rcu(&init_net, dev) {
623 if ((dev->flags & IFF_UP) && dev->type == ARPHRD_ROSE && rosecmp(addr, (rose_address *)dev->dev_addr) == 0) { 625 if ((dev->flags & IFF_UP) && dev->type == ARPHRD_ROSE && rosecmp(addr, (rose_address *)dev->dev_addr) == 0) {
624 dev_hold(dev); 626 dev_hold(dev);
625 goto out; 627 goto out;
@@ -627,7 +629,7 @@ struct net_device *rose_dev_get(rose_address *addr)
627 } 629 }
628 dev = NULL; 630 dev = NULL;
629out: 631out:
630 read_unlock(&dev_base_lock); 632 rcu_read_unlock();
631 return dev; 633 return dev;
632} 634}
633 635
@@ -635,14 +637,14 @@ static int rose_dev_exists(rose_address *addr)
635{ 637{
636 struct net_device *dev; 638 struct net_device *dev;
637 639
638 read_lock(&dev_base_lock); 640 rcu_read_lock();
639 for_each_netdev(&init_net, dev) { 641 for_each_netdev_rcu(&init_net, dev) {
640 if ((dev->flags & IFF_UP) && dev->type == ARPHRD_ROSE && rosecmp(addr, (rose_address *)dev->dev_addr) == 0) 642 if ((dev->flags & IFF_UP) && dev->type == ARPHRD_ROSE && rosecmp(addr, (rose_address *)dev->dev_addr) == 0)
641 goto out; 643 goto out;
642 } 644 }
643 dev = NULL; 645 dev = NULL;
644out: 646out:
645 read_unlock(&dev_base_lock); 647 rcu_read_unlock();
646 return dev != NULL; 648 return dev != NULL;
647} 649}
648 650
diff --git a/net/rose/sysctl_net_rose.c b/net/rose/sysctl_net_rose.c
index 3bfe504faf86..df6d9dac2186 100644
--- a/net/rose/sysctl_net_rose.c
+++ b/net/rose/sysctl_net_rose.c
@@ -26,121 +26,101 @@ static struct ctl_table_header *rose_table_header;
26 26
27static ctl_table rose_table[] = { 27static ctl_table rose_table[] = {
28 { 28 {
29 .ctl_name = NET_ROSE_RESTART_REQUEST_TIMEOUT,
30 .procname = "restart_request_timeout", 29 .procname = "restart_request_timeout",
31 .data = &sysctl_rose_restart_request_timeout, 30 .data = &sysctl_rose_restart_request_timeout,
32 .maxlen = sizeof(int), 31 .maxlen = sizeof(int),
33 .mode = 0644, 32 .mode = 0644,
34 .proc_handler = proc_dointvec_minmax, 33 .proc_handler = proc_dointvec_minmax,
35 .strategy = sysctl_intvec,
36 .extra1 = &min_timer, 34 .extra1 = &min_timer,
37 .extra2 = &max_timer 35 .extra2 = &max_timer
38 }, 36 },
39 { 37 {
40 .ctl_name = NET_ROSE_CALL_REQUEST_TIMEOUT,
41 .procname = "call_request_timeout", 38 .procname = "call_request_timeout",
42 .data = &sysctl_rose_call_request_timeout, 39 .data = &sysctl_rose_call_request_timeout,
43 .maxlen = sizeof(int), 40 .maxlen = sizeof(int),
44 .mode = 0644, 41 .mode = 0644,
45 .proc_handler = proc_dointvec_minmax, 42 .proc_handler = proc_dointvec_minmax,
46 .strategy = sysctl_intvec,
47 .extra1 = &min_timer, 43 .extra1 = &min_timer,
48 .extra2 = &max_timer 44 .extra2 = &max_timer
49 }, 45 },
50 { 46 {
51 .ctl_name = NET_ROSE_RESET_REQUEST_TIMEOUT,
52 .procname = "reset_request_timeout", 47 .procname = "reset_request_timeout",
53 .data = &sysctl_rose_reset_request_timeout, 48 .data = &sysctl_rose_reset_request_timeout,
54 .maxlen = sizeof(int), 49 .maxlen = sizeof(int),
55 .mode = 0644, 50 .mode = 0644,
56 .proc_handler = proc_dointvec_minmax, 51 .proc_handler = proc_dointvec_minmax,
57 .strategy = sysctl_intvec,
58 .extra1 = &min_timer, 52 .extra1 = &min_timer,
59 .extra2 = &max_timer 53 .extra2 = &max_timer
60 }, 54 },
61 { 55 {
62 .ctl_name = NET_ROSE_CLEAR_REQUEST_TIMEOUT,
63 .procname = "clear_request_timeout", 56 .procname = "clear_request_timeout",
64 .data = &sysctl_rose_clear_request_timeout, 57 .data = &sysctl_rose_clear_request_timeout,
65 .maxlen = sizeof(int), 58 .maxlen = sizeof(int),
66 .mode = 0644, 59 .mode = 0644,
67 .proc_handler = proc_dointvec_minmax, 60 .proc_handler = proc_dointvec_minmax,
68 .strategy = sysctl_intvec,
69 .extra1 = &min_timer, 61 .extra1 = &min_timer,
70 .extra2 = &max_timer 62 .extra2 = &max_timer
71 }, 63 },
72 { 64 {
73 .ctl_name = NET_ROSE_NO_ACTIVITY_TIMEOUT,
74 .procname = "no_activity_timeout", 65 .procname = "no_activity_timeout",
75 .data = &sysctl_rose_no_activity_timeout, 66 .data = &sysctl_rose_no_activity_timeout,
76 .maxlen = sizeof(int), 67 .maxlen = sizeof(int),
77 .mode = 0644, 68 .mode = 0644,
78 .proc_handler = proc_dointvec_minmax, 69 .proc_handler = proc_dointvec_minmax,
79 .strategy = sysctl_intvec,
80 .extra1 = &min_idle, 70 .extra1 = &min_idle,
81 .extra2 = &max_idle 71 .extra2 = &max_idle
82 }, 72 },
83 { 73 {
84 .ctl_name = NET_ROSE_ACK_HOLD_BACK_TIMEOUT,
85 .procname = "acknowledge_hold_back_timeout", 74 .procname = "acknowledge_hold_back_timeout",
86 .data = &sysctl_rose_ack_hold_back_timeout, 75 .data = &sysctl_rose_ack_hold_back_timeout,
87 .maxlen = sizeof(int), 76 .maxlen = sizeof(int),
88 .mode = 0644, 77 .mode = 0644,
89 .proc_handler = proc_dointvec_minmax, 78 .proc_handler = proc_dointvec_minmax,
90 .strategy = sysctl_intvec,
91 .extra1 = &min_timer, 79 .extra1 = &min_timer,
92 .extra2 = &max_timer 80 .extra2 = &max_timer
93 }, 81 },
94 { 82 {
95 .ctl_name = NET_ROSE_ROUTING_CONTROL,
96 .procname = "routing_control", 83 .procname = "routing_control",
97 .data = &sysctl_rose_routing_control, 84 .data = &sysctl_rose_routing_control,
98 .maxlen = sizeof(int), 85 .maxlen = sizeof(int),
99 .mode = 0644, 86 .mode = 0644,
100 .proc_handler = proc_dointvec_minmax, 87 .proc_handler = proc_dointvec_minmax,
101 .strategy = sysctl_intvec,
102 .extra1 = &min_route, 88 .extra1 = &min_route,
103 .extra2 = &max_route 89 .extra2 = &max_route
104 }, 90 },
105 { 91 {
106 .ctl_name = NET_ROSE_LINK_FAIL_TIMEOUT,
107 .procname = "link_fail_timeout", 92 .procname = "link_fail_timeout",
108 .data = &sysctl_rose_link_fail_timeout, 93 .data = &sysctl_rose_link_fail_timeout,
109 .maxlen = sizeof(int), 94 .maxlen = sizeof(int),
110 .mode = 0644, 95 .mode = 0644,
111 .proc_handler = proc_dointvec_minmax, 96 .proc_handler = proc_dointvec_minmax,
112 .strategy = sysctl_intvec,
113 .extra1 = &min_ftimer, 97 .extra1 = &min_ftimer,
114 .extra2 = &max_ftimer 98 .extra2 = &max_ftimer
115 }, 99 },
116 { 100 {
117 .ctl_name = NET_ROSE_MAX_VCS,
118 .procname = "maximum_virtual_circuits", 101 .procname = "maximum_virtual_circuits",
119 .data = &sysctl_rose_maximum_vcs, 102 .data = &sysctl_rose_maximum_vcs,
120 .maxlen = sizeof(int), 103 .maxlen = sizeof(int),
121 .mode = 0644, 104 .mode = 0644,
122 .proc_handler = proc_dointvec_minmax, 105 .proc_handler = proc_dointvec_minmax,
123 .strategy = sysctl_intvec,
124 .extra1 = &min_maxvcs, 106 .extra1 = &min_maxvcs,
125 .extra2 = &max_maxvcs 107 .extra2 = &max_maxvcs
126 }, 108 },
127 { 109 {
128 .ctl_name = NET_ROSE_WINDOW_SIZE,
129 .procname = "window_size", 110 .procname = "window_size",
130 .data = &sysctl_rose_window_size, 111 .data = &sysctl_rose_window_size,
131 .maxlen = sizeof(int), 112 .maxlen = sizeof(int),
132 .mode = 0644, 113 .mode = 0644,
133 .proc_handler = proc_dointvec_minmax, 114 .proc_handler = proc_dointvec_minmax,
134 .strategy = sysctl_intvec,
135 .extra1 = &min_window, 115 .extra1 = &min_window,
136 .extra2 = &max_window 116 .extra2 = &max_window
137 }, 117 },
138 { .ctl_name = 0 } 118 { }
139}; 119};
140 120
141static struct ctl_path rose_path[] = { 121static struct ctl_path rose_path[] = {
142 { .procname = "net", .ctl_name = CTL_NET, }, 122 { .procname = "net", },
143 { .procname = "rose", .ctl_name = NET_ROSE, }, 123 { .procname = "rose", },
144 { } 124 { }
145}; 125};
146 126