Blame view
net/sctp/proc.c
13.8 KB
60c778b25 [SCTP]: Stop clai... |
1 |
/* SCTP kernel implementation |
1da177e4c Linux-2.6.12-rc2 |
2 3 |
* Copyright (c) 2003 International Business Machines, Corp. * |
60c778b25 [SCTP]: Stop clai... |
4 |
* This file is part of the SCTP kernel implementation |
1da177e4c Linux-2.6.12-rc2 |
5 |
* |
60c778b25 [SCTP]: Stop clai... |
6 |
* This SCTP implementation is free software; |
1da177e4c Linux-2.6.12-rc2 |
7 8 9 10 11 |
* you can redistribute it and/or modify it under the terms of * the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * |
60c778b25 [SCTP]: Stop clai... |
12 |
* This SCTP implementation is distributed in the hope that it |
1da177e4c Linux-2.6.12-rc2 |
13 14 15 16 17 18 |
* will be useful, but WITHOUT ANY WARRANTY; without even the implied * ************************ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License |
4b2f13a25 sctp: Fix FSF add... |
19 20 |
* along with GNU CC; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. |
1da177e4c Linux-2.6.12-rc2 |
21 22 23 |
* * Please send any bug reports or fixes you make to the * email address(es): |
91705c61b net: sctp: trivia... |
24 |
* lksctp developers <linux-sctp@vger.kernel.org> |
1da177e4c Linux-2.6.12-rc2 |
25 |
* |
1da177e4c Linux-2.6.12-rc2 |
26 27 |
* Written or modified by: * Sridhar Samudrala <sri@us.ibm.com> |
1da177e4c Linux-2.6.12-rc2 |
28 29 30 31 32 |
*/ #include <linux/types.h> #include <linux/seq_file.h> #include <linux/init.h> |
bc3b2d7fb net: Add export.h... |
33 |
#include <linux/export.h> |
1da177e4c Linux-2.6.12-rc2 |
34 |
#include <net/sctp/sctp.h> |
3f5340a67 [SCTP]: Use snmp_... |
35 |
#include <net/ip.h> /* for snmp_fold_field */ |
1da177e4c Linux-2.6.12-rc2 |
36 |
|
5833929cc net: constify MIB... |
37 |
static const struct snmp_mib sctp_snmp_list[] = { |
1da177e4c Linux-2.6.12-rc2 |
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
SNMP_MIB_ITEM("SctpCurrEstab", SCTP_MIB_CURRESTAB), SNMP_MIB_ITEM("SctpActiveEstabs", SCTP_MIB_ACTIVEESTABS), SNMP_MIB_ITEM("SctpPassiveEstabs", SCTP_MIB_PASSIVEESTABS), SNMP_MIB_ITEM("SctpAborteds", SCTP_MIB_ABORTEDS), SNMP_MIB_ITEM("SctpShutdowns", SCTP_MIB_SHUTDOWNS), SNMP_MIB_ITEM("SctpOutOfBlues", SCTP_MIB_OUTOFBLUES), SNMP_MIB_ITEM("SctpChecksumErrors", SCTP_MIB_CHECKSUMERRORS), SNMP_MIB_ITEM("SctpOutCtrlChunks", SCTP_MIB_OUTCTRLCHUNKS), SNMP_MIB_ITEM("SctpOutOrderChunks", SCTP_MIB_OUTORDERCHUNKS), SNMP_MIB_ITEM("SctpOutUnorderChunks", SCTP_MIB_OUTUNORDERCHUNKS), SNMP_MIB_ITEM("SctpInCtrlChunks", SCTP_MIB_INCTRLCHUNKS), SNMP_MIB_ITEM("SctpInOrderChunks", SCTP_MIB_INORDERCHUNKS), SNMP_MIB_ITEM("SctpInUnorderChunks", SCTP_MIB_INUNORDERCHUNKS), SNMP_MIB_ITEM("SctpFragUsrMsgs", SCTP_MIB_FRAGUSRMSGS), SNMP_MIB_ITEM("SctpReasmUsrMsgs", SCTP_MIB_REASMUSRMSGS), SNMP_MIB_ITEM("SctpOutSCTPPacks", SCTP_MIB_OUTSCTPPACKS), SNMP_MIB_ITEM("SctpInSCTPPacks", SCTP_MIB_INSCTPPACKS), |
ac0b04627 [SCTP]: Extend /p... |
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
SNMP_MIB_ITEM("SctpT1InitExpireds", SCTP_MIB_T1_INIT_EXPIREDS), SNMP_MIB_ITEM("SctpT1CookieExpireds", SCTP_MIB_T1_COOKIE_EXPIREDS), SNMP_MIB_ITEM("SctpT2ShutdownExpireds", SCTP_MIB_T2_SHUTDOWN_EXPIREDS), SNMP_MIB_ITEM("SctpT3RtxExpireds", SCTP_MIB_T3_RTX_EXPIREDS), SNMP_MIB_ITEM("SctpT4RtoExpireds", SCTP_MIB_T4_RTO_EXPIREDS), SNMP_MIB_ITEM("SctpT5ShutdownGuardExpireds", SCTP_MIB_T5_SHUTDOWN_GUARD_EXPIREDS), SNMP_MIB_ITEM("SctpDelaySackExpireds", SCTP_MIB_DELAY_SACK_EXPIREDS), SNMP_MIB_ITEM("SctpAutocloseExpireds", SCTP_MIB_AUTOCLOSE_EXPIREDS), SNMP_MIB_ITEM("SctpT3Retransmits", SCTP_MIB_T3_RETRANSMITS), SNMP_MIB_ITEM("SctpPmtudRetransmits", SCTP_MIB_PMTUD_RETRANSMITS), SNMP_MIB_ITEM("SctpFastRetransmits", SCTP_MIB_FAST_RETRANSMITS), SNMP_MIB_ITEM("SctpInPktSoftirq", SCTP_MIB_IN_PKT_SOFTIRQ), SNMP_MIB_ITEM("SctpInPktBacklog", SCTP_MIB_IN_PKT_BACKLOG), SNMP_MIB_ITEM("SctpInPktDiscards", SCTP_MIB_IN_PKT_DISCARDS), SNMP_MIB_ITEM("SctpInDataChunkDiscards", SCTP_MIB_IN_DATA_CHUNK_DISCARDS), |
d2287f844 [SCTP]: Add SENTI... |
70 |
SNMP_MIB_SENTINEL |
1da177e4c Linux-2.6.12-rc2 |
71 |
}; |
1da177e4c Linux-2.6.12-rc2 |
72 73 74 |
/* Display sctp snmp mib statistics(/proc/net/sctp/snmp). */ static int sctp_snmp_seq_show(struct seq_file *seq, void *v) { |
13d782f6b sctp: Make the pr... |
75 |
struct net *net = seq->private; |
1da177e4c Linux-2.6.12-rc2 |
76 77 78 79 80 |
int i; for (i = 0; sctp_snmp_list[i].name != NULL; i++) seq_printf(seq, "%-32s\t%ld ", sctp_snmp_list[i].name, |
c9f2dba61 snmp: fix some le... |
81 |
snmp_fold_field(net->sctp.sctp_statistics, |
1da177e4c Linux-2.6.12-rc2 |
82 83 84 85 86 87 88 89 |
sctp_snmp_list[i].entry)); return 0; } /* Initialize the seq file operations for 'snmp' object. */ static int sctp_snmp_seq_open(struct inode *inode, struct file *file) { |
13d782f6b sctp: Make the pr... |
90 |
return single_open_net(inode, file, sctp_snmp_seq_show); |
1da177e4c Linux-2.6.12-rc2 |
91 |
} |
da7071d7e [PATCH] mark stru... |
92 |
static const struct file_operations sctp_snmp_seq_fops = { |
1da177e4c Linux-2.6.12-rc2 |
93 94 95 96 |
.owner = THIS_MODULE, .open = sctp_snmp_seq_open, .read = seq_read, .llseek = seq_lseek, |
0da9a0c26 sctp: fix /proc/n... |
97 |
.release = single_release_net, |
1da177e4c Linux-2.6.12-rc2 |
98 99 100 |
}; /* Set up the proc fs entry for 'snmp' object. */ |
13d782f6b sctp: Make the pr... |
101 |
int __net_init sctp_snmp_proc_init(struct net *net) |
1da177e4c Linux-2.6.12-rc2 |
102 103 |
{ struct proc_dir_entry *p; |
13d782f6b sctp: Make the pr... |
104 105 |
p = proc_create("snmp", S_IRUGO, net->sctp.proc_net_sctp, &sctp_snmp_seq_fops); |
1da177e4c Linux-2.6.12-rc2 |
106 107 |
if (!p) return -ENOMEM; |
1da177e4c Linux-2.6.12-rc2 |
108 109 110 111 |
return 0; } /* Cleanup the proc fs entry for 'snmp' object. */ |
13d782f6b sctp: Make the pr... |
112 |
void sctp_snmp_proc_exit(struct net *net) |
1da177e4c Linux-2.6.12-rc2 |
113 |
{ |
13d782f6b sctp: Make the pr... |
114 |
remove_proc_entry("snmp", net->sctp.proc_net_sctp); |
1da177e4c Linux-2.6.12-rc2 |
115 116 117 118 119 |
} /* Dump local addresses of an association/endpoint. */ static void sctp_seq_dump_local_addrs(struct seq_file *seq, struct sctp_ep_common *epb) { |
bca735bd0 [SCTP] Extend the... |
120 |
struct sctp_association *asoc; |
1da177e4c Linux-2.6.12-rc2 |
121 |
struct sctp_sockaddr_entry *laddr; |
bca735bd0 [SCTP] Extend the... |
122 123 |
struct sctp_transport *peer; union sctp_addr *addr, *primary = NULL; |
1da177e4c Linux-2.6.12-rc2 |
124 |
struct sctp_af *af; |
bca735bd0 [SCTP] Extend the... |
125 |
if (epb->type == SCTP_EP_TYPE_ASSOCIATION) { |
f9e42b853 net: sctp: sideef... |
126 127 128 129 |
asoc = sctp_assoc(epb); peer = asoc->peer.primary_path; if (unlikely(peer == NULL)) { |
b527fe693 net: sctp: minor:... |
130 131 |
WARN(1, "Association %p with NULL primary path! ", asoc); |
f9e42b853 net: sctp: sideef... |
132 133 134 135 |
return; } primary = &peer->saddr; |
bca735bd0 [SCTP] Extend the... |
136 |
} |
0b0fe913b sctp: proc: prote... |
137 138 139 140 |
rcu_read_lock(); list_for_each_entry_rcu(laddr, &epb->bind_addr.address_list, list) { if (!laddr->valid) continue; |
5f242a13e [SCTP]: Switch ->... |
141 |
addr = &laddr->a; |
1da177e4c Linux-2.6.12-rc2 |
142 |
af = sctp_get_af_specific(addr->sa.sa_family); |
bca735bd0 [SCTP] Extend the... |
143 144 145 |
if (primary && af->cmp_addr(addr, primary)) { seq_printf(seq, "*"); } |
5f242a13e [SCTP]: Switch ->... |
146 |
af->seq_dump_addr(seq, addr); |
1da177e4c Linux-2.6.12-rc2 |
147 |
} |
0b0fe913b sctp: proc: prote... |
148 |
rcu_read_unlock(); |
1da177e4c Linux-2.6.12-rc2 |
149 150 151 152 153 |
} /* Dump remote addresses of an association. */ static void sctp_seq_dump_remote_addrs(struct seq_file *seq, struct sctp_association *assoc) { |
1da177e4c Linux-2.6.12-rc2 |
154 |
struct sctp_transport *transport; |
bca735bd0 [SCTP] Extend the... |
155 |
union sctp_addr *addr, *primary; |
1da177e4c Linux-2.6.12-rc2 |
156 |
struct sctp_af *af; |
acd2bc96e [SCTP]: Switch ->... |
157 |
primary = &assoc->peer.primary_addr; |
45122ca26 sctp: Add RCU pro... |
158 |
list_for_each_entry_rcu(transport, &assoc->peer.transport_addr_list, |
9dbc15f05 [SCTP]: "list_for... |
159 |
transports) { |
5f242a13e [SCTP]: Switch ->... |
160 |
addr = &transport->ipaddr; |
45122ca26 sctp: Add RCU pro... |
161 |
|
1da177e4c Linux-2.6.12-rc2 |
162 |
af = sctp_get_af_specific(addr->sa.sa_family); |
acd2bc96e [SCTP]: Switch ->... |
163 |
if (af->cmp_addr(addr, primary)) { |
bca735bd0 [SCTP] Extend the... |
164 165 |
seq_printf(seq, "*"); } |
5f242a13e [SCTP]: Switch ->... |
166 |
af->seq_dump_addr(seq, addr); |
1da177e4c Linux-2.6.12-rc2 |
167 168 |
} } |
26ac8e5fe sctp: fix checkpa... |
169 |
static void *sctp_eps_seq_start(struct seq_file *seq, loff_t *pos) |
bca735bd0 [SCTP] Extend the... |
170 |
{ |
49392e5ec [SCTP]: sctp does... |
171 |
if (*pos >= sctp_ep_hashsize) |
bca735bd0 [SCTP] Extend the... |
172 173 174 175 176 177 178 179 |
return NULL; if (*pos < 0) *pos = 0; if (*pos == 0) seq_printf(seq, " ENDPT SOCK STY SST HBKT LPORT UID INODE LADDRS "); |
bca735bd0 [SCTP] Extend the... |
180 181 182 183 184 |
return (void *)pos; } static void sctp_eps_seq_stop(struct seq_file *seq, void *v) { |
bca735bd0 [SCTP] Extend the... |
185 |
} |
26ac8e5fe sctp: fix checkpa... |
186 |
static void *sctp_eps_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
bca735bd0 [SCTP] Extend the... |
187 |
{ |
49392e5ec [SCTP]: sctp does... |
188 |
if (++*pos >= sctp_ep_hashsize) |
bca735bd0 [SCTP] Extend the... |
189 |
return NULL; |
bca735bd0 [SCTP] Extend the... |
190 191 |
return pos; } |
1da177e4c Linux-2.6.12-rc2 |
192 193 194 195 196 197 198 |
/* Display sctp endpoints (/proc/net/sctp/eps). */ static int sctp_eps_seq_show(struct seq_file *seq, void *v) { struct sctp_hashbucket *head; struct sctp_ep_common *epb; struct sctp_endpoint *ep; struct sock *sk; |
38b0e42ab [SCTP]: Fix sctp_... |
199 |
int hash = *(loff_t *)v; |
bca735bd0 [SCTP] Extend the... |
200 |
|
49392e5ec [SCTP]: sctp does... |
201 |
if (hash >= sctp_ep_hashsize) |
bca735bd0 [SCTP] Extend the... |
202 |
return -ENOMEM; |
49392e5ec [SCTP]: sctp does... |
203 |
head = &sctp_ep_hashtable[hash]; |
79b91130a sctp: remove macr... |
204 |
local_bh_disable(); |
bca735bd0 [SCTP] Extend the... |
205 |
read_lock(&head->lock); |
b67bfe0d4 hlist: drop the n... |
206 |
sctp_for_each_hentry(epb, &head->chain) { |
bca735bd0 [SCTP] Extend the... |
207 208 |
ep = sctp_ep(epb); sk = epb->sk; |
6932f119b sctp: fix compile... |
209 |
if (!net_eq(sock_net(sk), seq_file_net(seq))) |
13d782f6b sctp: Make the pr... |
210 |
continue; |
d14c5ab6b net: proc_fs: tri... |
211 |
seq_printf(seq, "%8pK %8pK %-3d %-3d %-4d %-5d %5u %5lu ", ep, sk, |
49392e5ec [SCTP]: sctp does... |
212 |
sctp_sk(sk)->type, sk->sk_state, hash, |
bca735bd0 [SCTP] Extend the... |
213 |
epb->bind_addr.port, |
a7cb5a49b userns: Print out... |
214 215 |
from_kuid_munged(seq_user_ns(seq), sock_i_uid(sk)), sock_i_ino(sk)); |
bca735bd0 [SCTP] Extend the... |
216 217 218 219 |
sctp_seq_dump_local_addrs(seq, epb); seq_printf(seq, " "); |
1da177e4c Linux-2.6.12-rc2 |
220 |
} |
bca735bd0 [SCTP] Extend the... |
221 |
read_unlock(&head->lock); |
79b91130a sctp: remove macr... |
222 |
local_bh_enable(); |
1da177e4c Linux-2.6.12-rc2 |
223 224 225 |
return 0; } |
56b3d975b [NET]: Make all i... |
226 |
static const struct seq_operations sctp_eps_ops = { |
bca735bd0 [SCTP] Extend the... |
227 228 229 230 231 |
.start = sctp_eps_seq_start, .next = sctp_eps_seq_next, .stop = sctp_eps_seq_stop, .show = sctp_eps_seq_show, }; |
1da177e4c Linux-2.6.12-rc2 |
232 233 234 |
/* Initialize the seq file operations for 'eps' object. */ static int sctp_eps_seq_open(struct inode *inode, struct file *file) { |
13d782f6b sctp: Make the pr... |
235 236 |
return seq_open_net(inode, file, &sctp_eps_ops, sizeof(struct seq_net_private)); |
1da177e4c Linux-2.6.12-rc2 |
237 |
} |
da7071d7e [PATCH] mark stru... |
238 |
static const struct file_operations sctp_eps_seq_fops = { |
1da177e4c Linux-2.6.12-rc2 |
239 240 241 |
.open = sctp_eps_seq_open, .read = seq_read, .llseek = seq_lseek, |
0da9a0c26 sctp: fix /proc/n... |
242 |
.release = seq_release_net, |
1da177e4c Linux-2.6.12-rc2 |
243 244 245 |
}; /* Set up the proc fs entry for 'eps' object. */ |
13d782f6b sctp: Make the pr... |
246 |
int __net_init sctp_eps_proc_init(struct net *net) |
1da177e4c Linux-2.6.12-rc2 |
247 248 |
{ struct proc_dir_entry *p; |
13d782f6b sctp: Make the pr... |
249 250 |
p = proc_create("eps", S_IRUGO, net->sctp.proc_net_sctp, &sctp_eps_seq_fops); |
1da177e4c Linux-2.6.12-rc2 |
251 252 |
if (!p) return -ENOMEM; |
1da177e4c Linux-2.6.12-rc2 |
253 254 255 256 |
return 0; } /* Cleanup the proc fs entry for 'eps' object. */ |
13d782f6b sctp: Make the pr... |
257 |
void sctp_eps_proc_exit(struct net *net) |
1da177e4c Linux-2.6.12-rc2 |
258 |
{ |
13d782f6b sctp: Make the pr... |
259 |
remove_proc_entry("eps", net->sctp.proc_net_sctp); |
1da177e4c Linux-2.6.12-rc2 |
260 |
} |
39f66a7dc sctp: apply rhash... |
261 262 263 |
struct sctp_ht_iter { struct seq_net_private p; struct rhashtable_iter hti; |
53fa10369 sctp: fix some rh... |
264 |
int start_fail; |
39f66a7dc sctp: apply rhash... |
265 |
}; |
bca735bd0 [SCTP] Extend the... |
266 |
|
b5e2f4e69 sctp: merge the s... |
267 |
static void *sctp_transport_seq_start(struct seq_file *seq, loff_t *pos) |
39f66a7dc sctp: apply rhash... |
268 |
{ |
626d16f50 sctp: export some... |
269 270 |
struct sctp_ht_iter *iter = seq->private; int err = sctp_transport_walk_start(&iter->hti); |
39f66a7dc sctp: apply rhash... |
271 |
|
53fa10369 sctp: fix some rh... |
272 273 |
if (err) { iter->start_fail = 1; |
39f66a7dc sctp: apply rhash... |
274 |
return ERR_PTR(err); |
53fa10369 sctp: fix some rh... |
275 |
} |
39f66a7dc sctp: apply rhash... |
276 |
|
626d16f50 sctp: export some... |
277 |
return sctp_transport_get_idx(seq_file_net(seq), &iter->hti, *pos); |
39f66a7dc sctp: apply rhash... |
278 |
} |
b5e2f4e69 sctp: merge the s... |
279 |
static void sctp_transport_seq_stop(struct seq_file *seq, void *v) |
39f66a7dc sctp: apply rhash... |
280 |
{ |
626d16f50 sctp: export some... |
281 |
struct sctp_ht_iter *iter = seq->private; |
53fa10369 sctp: fix some rh... |
282 283 |
if (iter->start_fail) return; |
626d16f50 sctp: export some... |
284 |
sctp_transport_walk_stop(&iter->hti); |
39f66a7dc sctp: apply rhash... |
285 |
} |
bca735bd0 [SCTP] Extend the... |
286 |
|
b5e2f4e69 sctp: merge the s... |
287 |
static void *sctp_transport_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
bca735bd0 [SCTP] Extend the... |
288 |
{ |
626d16f50 sctp: export some... |
289 |
struct sctp_ht_iter *iter = seq->private; |
39f66a7dc sctp: apply rhash... |
290 |
++*pos; |
bca735bd0 [SCTP] Extend the... |
291 |
|
626d16f50 sctp: export some... |
292 |
return sctp_transport_get_next(seq_file_net(seq), &iter->hti); |
bca735bd0 [SCTP] Extend the... |
293 |
} |
1da177e4c Linux-2.6.12-rc2 |
294 295 296 |
/* Display sctp associations (/proc/net/sctp/assocs). */ static int sctp_assocs_seq_show(struct seq_file *seq, void *v) { |
39f66a7dc sctp: apply rhash... |
297 |
struct sctp_transport *transport; |
1da177e4c Linux-2.6.12-rc2 |
298 |
struct sctp_association *assoc; |
39f66a7dc sctp: apply rhash... |
299 |
struct sctp_ep_common *epb; |
1da177e4c Linux-2.6.12-rc2 |
300 |
struct sock *sk; |
bca735bd0 [SCTP] Extend the... |
301 |
|
39f66a7dc sctp: apply rhash... |
302 303 304 305 306 307 308 309 |
if (v == SEQ_START_TOKEN) { seq_printf(seq, " ASSOC SOCK STY SST ST HBKT " "ASSOC-ID TX_QUEUE RX_QUEUE UID INODE LPORT " "RPORT LADDRS <-> RADDRS " "HBINT INS OUTS MAXRT T1X T2X RTXC " "wmema wmemq sndbuf rcvbuf "); return 0; |
1da177e4c Linux-2.6.12-rc2 |
310 |
} |
39f66a7dc sctp: apply rhash... |
311 312 |
transport = (struct sctp_transport *)v; |
fba4c330c sctp: hold transp... |
313 314 |
if (!sctp_transport_hold(transport)) return 0; |
39f66a7dc sctp: apply rhash... |
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 |
assoc = transport->asoc; epb = &assoc->base; sk = epb->sk; seq_printf(seq, "%8pK %8pK %-3d %-3d %-2d %-4d " "%4d %8d %8d %7u %5lu %-5d %5d ", assoc, sk, sctp_sk(sk)->type, sk->sk_state, assoc->state, 0, assoc->assoc_id, assoc->sndbuf_used, atomic_read(&assoc->rmem_alloc), from_kuid_munged(seq_user_ns(seq), sock_i_uid(sk)), sock_i_ino(sk), epb->bind_addr.port, assoc->peer.port); seq_printf(seq, " "); sctp_seq_dump_local_addrs(seq, epb); seq_printf(seq, "<-> "); sctp_seq_dump_remote_addrs(seq, assoc); seq_printf(seq, "\t%8lu %5d %5d %4d %4d %4d %8d " "%8d %8d %8d %8d", assoc->hbinterval, assoc->c.sinit_max_instreams, assoc->c.sinit_num_ostreams, assoc->max_retrans, assoc->init_retries, assoc->shutdown_retries, assoc->rtx_data_chunks, atomic_read(&sk->sk_wmem_alloc), sk->sk_wmem_queued, sk->sk_sndbuf, sk->sk_rcvbuf); seq_printf(seq, " "); |
1da177e4c Linux-2.6.12-rc2 |
347 |
|
fba4c330c sctp: hold transp... |
348 |
sctp_transport_put(transport); |
1da177e4c Linux-2.6.12-rc2 |
349 350 |
return 0; } |
56b3d975b [NET]: Make all i... |
351 |
static const struct seq_operations sctp_assoc_ops = { |
b5e2f4e69 sctp: merge the s... |
352 353 354 |
.start = sctp_transport_seq_start, .next = sctp_transport_seq_next, .stop = sctp_transport_seq_stop, |
bca735bd0 [SCTP] Extend the... |
355 356 |
.show = sctp_assocs_seq_show, }; |
1da177e4c Linux-2.6.12-rc2 |
357 358 359 |
/* Initialize the seq file operations for 'assocs' object. */ static int sctp_assocs_seq_open(struct inode *inode, struct file *file) { |
13d782f6b sctp: Make the pr... |
360 |
return seq_open_net(inode, file, &sctp_assoc_ops, |
39f66a7dc sctp: apply rhash... |
361 |
sizeof(struct sctp_ht_iter)); |
1da177e4c Linux-2.6.12-rc2 |
362 |
} |
da7071d7e [PATCH] mark stru... |
363 |
static const struct file_operations sctp_assocs_seq_fops = { |
1da177e4c Linux-2.6.12-rc2 |
364 365 366 |
.open = sctp_assocs_seq_open, .read = seq_read, .llseek = seq_lseek, |
0da9a0c26 sctp: fix /proc/n... |
367 |
.release = seq_release_net, |
1da177e4c Linux-2.6.12-rc2 |
368 369 370 |
}; /* Set up the proc fs entry for 'assocs' object. */ |
13d782f6b sctp: Make the pr... |
371 |
int __net_init sctp_assocs_proc_init(struct net *net) |
1da177e4c Linux-2.6.12-rc2 |
372 373 |
{ struct proc_dir_entry *p; |
13d782f6b sctp: Make the pr... |
374 |
p = proc_create("assocs", S_IRUGO, net->sctp.proc_net_sctp, |
459eea741 [SCTP]: Use proc_... |
375 |
&sctp_assocs_seq_fops); |
1da177e4c Linux-2.6.12-rc2 |
376 377 |
if (!p) return -ENOMEM; |
1da177e4c Linux-2.6.12-rc2 |
378 379 380 381 |
return 0; } /* Cleanup the proc fs entry for 'assocs' object. */ |
13d782f6b sctp: Make the pr... |
382 |
void sctp_assocs_proc_exit(struct net *net) |
1da177e4c Linux-2.6.12-rc2 |
383 |
{ |
13d782f6b sctp: Make the pr... |
384 |
remove_proc_entry("assocs", net->sctp.proc_net_sctp); |
1da177e4c Linux-2.6.12-rc2 |
385 |
} |
20c2c1fd6 sctp: add sctp/re... |
386 |
|
20c2c1fd6 sctp: add sctp/re... |
387 388 |
static int sctp_remaddr_seq_show(struct seq_file *seq, void *v) { |
20c2c1fd6 sctp: add sctp/re... |
389 |
struct sctp_association *assoc; |
3d73e8fac sctp: sctp_remadd... |
390 |
struct sctp_transport *transport, *tsp; |
20c2c1fd6 sctp: add sctp/re... |
391 |
|
39f66a7dc sctp: apply rhash... |
392 393 394 395 396 397 |
if (v == SEQ_START_TOKEN) { seq_printf(seq, "ADDR ASSOC_ID HB_ACT RTO MAX_PATH_RTX " "REM_ADDR_RTX START STATE "); return 0; } |
20c2c1fd6 sctp: add sctp/re... |
398 |
|
3d73e8fac sctp: sctp_remadd... |
399 400 |
transport = (struct sctp_transport *)v; if (!sctp_transport_hold(transport)) |
fba4c330c sctp: hold transp... |
401 |
return 0; |
3d73e8fac sctp: sctp_remadd... |
402 |
assoc = transport->asoc; |
39f66a7dc sctp: apply rhash... |
403 404 405 |
list_for_each_entry_rcu(tsp, &assoc->peer.transport_addr_list, transports) { |
39f66a7dc sctp: apply rhash... |
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
/* * The remote address (ADDR) */ tsp->af_specific->seq_dump_addr(seq, &tsp->ipaddr); seq_printf(seq, " "); /* * The association ID (ASSOC_ID) */ seq_printf(seq, "%d ", tsp->asoc->assoc_id); /* * If the Heartbeat is active (HB_ACT) * Note: 1 = Active, 0 = Inactive */ seq_printf(seq, "%d ", timer_pending(&tsp->hb_timer)); /* * Retransmit time out (RTO) */ seq_printf(seq, "%lu ", tsp->rto); /* * Maximum path retransmit count (PATH_MAX_RTX) */ seq_printf(seq, "%d ", tsp->pathmaxrxt); /* * remote address retransmit count (REM_ADDR_RTX) * Note: We don't have a way to tally this at the moment * so lets just leave it as zero for the moment */ seq_puts(seq, "0 "); /* * remote address start time (START). This is also not * currently implemented, but we can record it with a * jiffies marker in a subsequent patch */ seq_puts(seq, "0 "); /* * The current state of this destination. I.e. * SCTP_ACTIVE, SCTP_INACTIVE, ... */ seq_printf(seq, "%d", tsp->state); |
45122ca26 sctp: Add RCU pro... |
451 |
|
39f66a7dc sctp: apply rhash... |
452 453 |
seq_printf(seq, " "); |
20c2c1fd6 sctp: add sctp/re... |
454 |
} |
3d73e8fac sctp: sctp_remadd... |
455 |
sctp_transport_put(transport); |
fba4c330c sctp: hold transp... |
456 |
|
20c2c1fd6 sctp: add sctp/re... |
457 |
return 0; |
20c2c1fd6 sctp: add sctp/re... |
458 459 460 |
} static const struct seq_operations sctp_remaddr_ops = { |
b5e2f4e69 sctp: merge the s... |
461 462 463 |
.start = sctp_transport_seq_start, .next = sctp_transport_seq_next, .stop = sctp_transport_seq_stop, |
20c2c1fd6 sctp: add sctp/re... |
464 465 466 467 |
.show = sctp_remaddr_seq_show, }; /* Cleanup the proc fs entry for 'remaddr' object. */ |
13d782f6b sctp: Make the pr... |
468 |
void sctp_remaddr_proc_exit(struct net *net) |
20c2c1fd6 sctp: add sctp/re... |
469 |
{ |
13d782f6b sctp: Make the pr... |
470 |
remove_proc_entry("remaddr", net->sctp.proc_net_sctp); |
20c2c1fd6 sctp: add sctp/re... |
471 472 473 474 |
} static int sctp_remaddr_seq_open(struct inode *inode, struct file *file) { |
13d782f6b sctp: Make the pr... |
475 |
return seq_open_net(inode, file, &sctp_remaddr_ops, |
39f66a7dc sctp: apply rhash... |
476 |
sizeof(struct sctp_ht_iter)); |
20c2c1fd6 sctp: add sctp/re... |
477 478 479 480 481 482 |
} static const struct file_operations sctp_remaddr_seq_fops = { .open = sctp_remaddr_seq_open, .read = seq_read, .llseek = seq_lseek, |
0da9a0c26 sctp: fix /proc/n... |
483 |
.release = seq_release_net, |
20c2c1fd6 sctp: add sctp/re... |
484 |
}; |
13d782f6b sctp: Make the pr... |
485 |
int __net_init sctp_remaddr_proc_init(struct net *net) |
20c2c1fd6 sctp: add sctp/re... |
486 487 |
{ struct proc_dir_entry *p; |
13d782f6b sctp: Make the pr... |
488 489 |
p = proc_create("remaddr", S_IRUGO, net->sctp.proc_net_sctp, &sctp_remaddr_seq_fops); |
20c2c1fd6 sctp: add sctp/re... |
490 491 |
if (!p) return -ENOMEM; |
20c2c1fd6 sctp: add sctp/re... |
492 493 |
return 0; } |