linux/net/sctp/proc.c
<<
valu12valu12>>vavaluvalu12 ">valu12valu12Searchvalu12Prefs. 12vava ">vlu12 2.
2 21/* SCTP kernel implementa v2 22 * Copyright (c) 2003 Interna val Business Machines, Corp.2 23 *2 24 * This file is part of the SCTP kernel implementa v2 25 *2 26 * This SCTP implementa v is free software;2 27 * you cav redistribute it and/or modify it under the terms of2 28 * the GNU General Public License as published by2 29 * the Free Software Founda v; either vers v 2, or (at your > v)2 " a> * any later vers v.2 11 *2 12 * This SCTP implementa v is distributed in the hope that it2 13 * will be useful, but WITHOUT ANY WARRANTY; without even the implied2 14 * ************************2 15 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.2 16 * See the GNU General Public License for more details.2 17 *2 18 * You should have received a copy of the GNU General Public License2 19 * along with GNU CC; see the file COPYING. If not, write to2 2 a> * the Free Software Founda v, 59 Temple Place - Suite 330,2 21 * Bost v, MA 02111-1307, USA.2 22 *2 23 * Please send any bug reports or fixes you make to the2 24 * email address(es):2 25 * lksctp developers <lksctp-developers@lists.sourceforge.net>2 26 *2 27 * Or submit a bug report through the following website:2 28 * 12 http://www.sf.net/projects/lksctp2 29 *2 3 a> * Written or modified by:2 31 * Sridhar Samudrala <sri@us.ibm.com>2 32 *2 33 * Any bugs reported given to us we will try to fix... any fixes shared will2 34 * be incorporated into the next SCTP release.2 35 */2 36.2 37#include <linux/typ s.h>.2 38#include <linux/seq_file.h>.2 39#include <linux/init.h>.2 40#include <linux/export.h>.2 41#include <net/sctp/sctp.h>.2 42#include <net/ip.h> /* for snmp_fold_field */2 43.2 44static const struct2snmp_mib2sctp_snmp_list[] = {.2 45 SNMP_MIB_ITEM("SctpCurrEstab"SCTP_MIB_CURRESTAB),.2 46 SNMP_MIB_ITEM("SctpActiveEstabs"SCTP_MIB_ACTIVEESTABS),.2 47 SNMP_MIB_ITEM("SctpPassiveEstabs"SCTP_MIB_PASSIVEESTABS),.2 48 SNMP_MIB_ITEM("SctpAborteds"SCTP_MIB_ABORTEDS),.2 49 SNMP_MIB_ITEM("SctpShutdowns"SCTP_MIB_SHUTDOWNS),.2 50 SNMP_MIB_ITEM("SctpOutOfBlues"SCTP_MIB_OUTOFBLUES),.2 51 SNMP_MIB_ITEM("SctpChecksumErrors"SCTP_MIB_CHECKSUMERRORS),.2 52 SNMP_MIB_ITEM("SctpOutCtrlChunks"SCTP_MIB_OUTCTRLCHUNKS),.2 53 SNMP_MIB_ITEM("SctpOutOrderChunks"SCTP_MIB_OUTORDERCHUNKS),.2 54 SNMP_MIB_ITEM("SctpOutUnorderChunks"SCTP_MIB_OUTUNORDERCHUNKS),.2 55 SNMP_MIB_ITEM("SctpInCtrlChunks"SCTP_MIB_INCTRLCHUNKS),.2 56 SNMP_MIB_ITEM("SctpInOrderChunks"SCTP_MIB_INORDERCHUNKS),.2 57 SNMP_MIB_ITEM("SctpInUnorderChunks"SCTP_MIB_INUNORDERCHUNKS),.2 58 SNMP_MIB_ITEM("SctpFragUsrMsgs"SCTP_MIB_FRAGUSRMSGS),.2 59 SNMP_MIB_ITEM("SctpReasmUsrMsgs"SCTP_MIB_REASMUSRMSGS),.2 60 SNMP_MIB_ITEM("SctpOutSCTPPacks"SCTP_MIB_OUTSCTPPACKS),.2 61 SNMP_MIB_ITEM("SctpInSCTPPacks"SCTP_MIB_INSCTPPACKS),.2 62 SNMP_MIB_ITEM("SctpT1InitExpireds"SCTP_MIB_T1_INIT_EXPIREDS),.2 63 SNMP_MIB_ITEM("SctpT1CookieExpireds"SCTP_MIB_T1_COOKIE_EXPIREDS),.2 64 SNMP_MIB_ITEM("SctpT2ShutdownExpireds"SCTP_MIB_T2_SHUTDOWN_EXPIREDS),.2 65 SNMP_MIB_ITEM("SctpT3RtxExpireds"SCTP_MIB_T3_RTX_EXPIREDS),.2 66 SNMP_MIB_ITEM("SctpT4RtoExpireds"SCTP_MIB_T4_RTO_EXPIREDS),.2 67 SNMP_MIB_ITEM("SctpT5ShutdownGuardExpireds"SCTP_MIB_T5_SHUTDOWN_GUARD_EXPIREDS),.2 68 SNMP_MIB_ITEM("SctpDelaySackExpireds"SCTP_MIB_DELAY_SACK_EXPIREDS),.2 69 SNMP_MIB_ITEM("SctpAutocloseExpireds"SCTP_MIB_AUTOCLOSE_EXPIREDS),.2 70 SNMP_MIB_ITEM("SctpT3Retransmits"SCTP_MIB_T3_RETRANSMITS),.2 71 SNMP_MIB_ITEM("SctpPmtudRetransmits"SCTP_MIB_PMTUD_RETRANSMITS),.2 72 SNMP_MIB_ITEM("SctpFastRetransmits"SCTP_MIB_FAST_RETRANSMITS),.2 73 SNMP_MIB_ITEM("SctpInPktSoftirq"SCTP_MIB_IN_PKT_SOFTIRQ),.2 74 SNMP_MIB_ITEM("SctpInPktBacklog"SCTP_MIB_IN_PKT_BACKLOG),.2 75 SNMP_MIB_ITEM("SctpInPktDiscards"SCTP_MIB_IN_PKT_DISCARDS),.2 76 SNMP_MIB_ITEM("SctpInDataChunkDiscards"SCTP_MIB_IN_DATA_CHUNK_DISCARDS),.2 77 SNMP_MIB_SENTINEL.2 78};.2 79.2 8 a>/* Display sctp snmp mib statistics(/proc/net/sctp/snmp). */2 81static int2sctp_snmp_seq_show(struct2seq_file *seq, void *v).2 82{.2 83 struct2net *net =2seq->private;.2 84 int2i;.2 85.2 86 for (i =20;2sctp_snmp_list[i].nam !=2NULL;2i++).2 87 seq_printf(seq, "%-32s\t%ld\n"sctp_snmp_list[i].nam ,.2 88 snmp_fold_field((void __percpu **)net->sctp.sctp_statistics,.2 89 sctp_snmp_list[i].entry));.2 90.2 91 return 0;.2 92}.2 93.2 94/* Initialize the seq file opera vs for 'snmp' object. */2 95static int2sctp_snmp_seq_open(struct2inode *inode, struct2file *file).2 96{.2 97 return single_open_net(inode, file, sctp_snmp_seq_show);.2 98}.2 99.2100static const struct2file_opera vs sctp_snmp_seq_fops =2{.2101 .owner =2THIS_MODULE,.2102 .open =2sctp_snmp_seq_open,.2103 .read =2seq_read,.2104 .llseek =2seq_lseek,.,.singlef="neten_nek,.};../*et upze thp/pr fs ">entvs for 'snmp' object. */n_n_x/invs net *net).1101 >(struct2;. pr_cq_rvaEM(&quo9;snms", net->sctp.pr_n_n_e=sctp" class="sref">pr_n_n_e=scek,. &gt;sctp_snmp_seq_fops);. retur- . return 0;.}../C="nnupze thp/pr fs ">entvs for 'snmp' object. */net *net). &quo9;snms"net->sctp.pr_n_n_e=sctp" class="sref">pr_n_n_e=scek);.}../*ump locaail addreerms spaclaociera /endpoc ict. */stati((void sctp_sedusnmpocaa_l adoow(struct2seq_file *seq>(struct2sctep_="coople * >(struct2sctclaociera le * >(struct2sctpockl ad_e=entry" class="sref">sctpockl ad_e=entle *i;. >(struct2sctRetraexpory" class="sref">sctRetraexpoet * una t2NULL;. >(struct2sctcnle *. if ( *SCTEP_TYPE_ASSOCIATIONEL" class="sref">SCTEP_TYPE_ASSOCIATIONet *sctclaocet( *imant_pathry" class="srefp/imant_pathle;. * a>}.}. i-> *i-> *sctg_n_af_specificet(;. a> if ( * *seq_printf(seq, &quo*ms";. a>}. *seq,( a>}.}.}./*ump remoteil addreerms spaclaociera ct. */stati((void sctp_sedusnmremote_l adoow(struct2seq_file *seq>(struct2sctclaociera le * >(struct2sctRetraexpory" class="sref">sctRetraexpoet * una t2 >(struct2sctcnle *;. imant_a adek" class="sref">imant_a adle;. a> * * *sctg_n_af_specificet(;. if ( * a> *seq_printf(seq, &quo*ms";. a>}. seq,( a>}.}..stati, voidct2sctepsmp_seqtapoow(struct2seq_file *seq {. if (> *i). return NULL;.. if (> * > *;. if (> * seq_printf(seq, &quo ENDPT SOCK STY SST HBKT LPORT UID INODE LADDRSld\n";.}. retur>((voi **)}.}.stati, voit2sctepsmp_seqtocow(struct2seq_file *seq, void *v).{.}.;..stati, voidct2sctepsmp_see neow(struct2seq_file *seq, void *v {. if (++> *i). return NULL;.}. retur*)}..;./* Display sctendpoc is cs(/proc/net/sctepsmp). */static int2sctepsmp_seq_show(struct2seq_file *seq, void *v).{. >(struct2scthashbuck_nle * >(struct2sctep_="coople * >(struct2sctendpoc ile * >(struct2 *;. >(struct2 c in v;.;. if ( i). retur- }. [ ;. scts f_each_he=enttf( * ;. if (! (, seq_fien_ntf(seq). continuea>;. seq_printf(seq, &quo\t&pK \t&pK \t-3d \t-3d \t-4d \t-5d \t#d \t#lu ms";. a> 100 (->->i, * *seq, (),. 100 (;.. *sctp_sedusnmpocaa_l adops" class="sref">sctp_sedusnmpocaa_l adoow(seq,( seq_printf(seq, &quold\n";. a>}. ;.}. return 0;.}.}.static const struct2sctepsm_foet a>.sctepsmp_seqtapoow),. >].sctepsmp_see neow),. a>.sctepsmp_seqtocow),. a>.sctepsmp_seq_show),.};.}.;./* Initialize the seq file opera vs for epsmp' object. */static int2sctepsmp_seq_opow(struct2inode *inode, struct2file *file). return see_open_net(inode, file&gt;sctepsm_foet),. siziofa>(struct2}..static const struct2file_opera vs sctepsmp_seq_foet .open =2sctepsmp_seq_opow),. .;..).sctepsmp_ry" class2"sref">sctRetraexpoet.sctcntf" class="sr2f">sc2cnleentvs for 'snmp' object. */ss="line" nam 09ctp/p 92510ss="lid 2LL14" class="line" nam 7/a>.;.s " =2{.1101 >(struct2i.2 a> *<2 href26L11" id 2LL11" class="line" nam L12"12 12;. pr_cq_rvaEM(&quo9;snms", net->net-rrrrrrrrrseq_open_net" class="sref">seine" nam 2 L50"25100static const struct"line" nam 2 L47"24 87 adle-2gt;sctp_snmp_seq_fops);.i).seq2printf(;.( a>}...}., ss="lid 2LL14" class="line" nam 7/a>.s2q [ pr_cq_rvaEM(&quo9;snms", "+codcoop2" class="srefcoo>i-&2 =2<2 href="+code=sen_n_e=private" class1 L74" cl2ss="line" nam 1 L74"171242 return NULL;. tp/proc.c1#L89" id 1 L89" class="la" clproc.c2#L36" id 2 L36" class="la" clproc.c2#L36p 92510ss="lid 2LL14" c"line" nam 1 L71"17 81stati, voidct2sctepsmp_seqtapoow(struct2seq_file * srefpoff_iet *;. * if (> *i)., &quo E2DPT 2 SOCK STY SST HBKT LPORT UID2INODE LAD2RSld\n";..net-r78" id 1 L78" class="line" nam 1 L78"17 58# id 2 L31" class="line" nam 2odcoops" 2lass="srefcoo>i;.}.;.se2_file *i). s="sr503" a href="+code=se=seq_pr v). s="sr-ID TX_QUEUE RX_QUEUE ass="sref">ntf" {.-ctepsm_fops"03" inam 1 L80"18087 Rntf" >seq_p5<}.seq_fien_ntf( HBINT="sS OUTS MAXf" T1X T2X RTXC ;. }.294a> tp/proc.c1#L" id 1 L89" class="la" clproc.c2##L18" id 2 L38" class=a" clproc.c2##Lp 92510ss="lid 2LL14" c"line" nam 1 L71"17 81stati, voidct2sctepsmp_seq_show(struct2NULL;.file * retur*)}..ss="lid 2LL14" c"line" nam 1 L71"17 81stati, voidct2sctepsmp_seq_show(struct2sctepsmp_seqtapoow(struct2seq_file *net *se3_file *{. *v).i, hsizile" class="sref"=sctep_hashsizi>i).sctep_="coopen" cl3ss="s3ef">sctep_="coc1#L94" id 1 L94" class="line" nam 1 L94"19 84}.sctendpoc ien"3class30>.pr_n_n_e=sctp" c30 55 3 >(struct2;.(/*ump loc file opera vs for a" clproc.c22#L19" id 2 L39" class=a" clproc.c22#Lp 92510ss="lid 2LL14" c"line" nam 1 L71"17 81stati, voidct2sctepsmp_seq_show(struct2 *. *i-&3 =2<31.{. >(struct2 * >(struc3MITEM" cl3ss="srefENOMIT>i;.seq_file * >(struc3Mref="+co3tep_hashtabfile" class="3ref"=31scthashbuck_nle * *;. >3oceow * c in ;. *-hsizile" class="sref"=sctep_hashsizi>i)., ->}. -&g3;;. [scts f_each_he=enttf(seq_file * *, ;. ;.;. if (! ((seq,,,,,,,,,"+code=seq" class="sref">seq).3ref">seq_3rintf(i).seq).3r>, ;.seq_fien_ntf( ="sref">8"sref">8"sref">7(seq_printf&quo\t&pK \t&pK \t-3d \t-f="+codeeek" class="sref"ket;. a> 100 (->i, }.i.( return 0;.(}., ;. *seq_3" class="srefe neow-ctepsm_fops>;. *seq_fien_ntf( continuea>;. sc3epsmp_seq_show),.. *sctp_sedusnmpocaa_l adops" class="sref">sctp_se3s="line" 3am 2 L40"24 70};.;. }.-> */3 Init34="sref"oceei_uidtfseq_filepmib" class="srefepmet;. tref">8hrefef">eq_printf((((, .file)..fi3e3ampgt;seq_3 siziofa>(st3uct2<34class="srefepmet-ctepsm_ff="net/sctp/pro *;.seq_fien_ntf(f">seq_filepmib" class="srefepmet;. }.pr_n_n_e=sctp" c3 class="s3ef">file_opera vs 3a hre35ib" class="sr}. a>}. open 3=2;.sctep_="coc1#L94" id 2 L31" class="line" nam 3"stass="l3ne" namt2).pr_n_n_e=sctp" c3"sref">sc3epsmp_ry" class2"sref">s3tRetr3expoet}.staa" clcnam 2LL/aa"+codeinode" class=srefreadt33"24389sc3cntf"35ef="+code=sctepsmp_see netp" clclass="sref">sctepsm_foet2="srefcnl2;.sctepsmp_seqtapoow),.sctepsmp_see neow),.i.<3 href36"+code=sctepsmp_seq_fops" claclass="sref">sctepsmp_seqtocow),.2 a> 3 3 p/p2oc.c12L54" iq_show" class3t;36href=+code=sen_n_e=private" clas3adle-3gt;;.3static int2sctepsmp_seq_opow(struct2inode *seq3printf(seq, void *;. return staa" clcnam 2LLf="+codepmib" class="srefepm3o"24389(sctepsm_foet),. 3lass="sre3c adle;.pr_n_n_e=sctp" c3 nam 1 L38"12 68 a>}.}..staa" clproc.c nam 2LL/aa"+codeinode" class=srefreadt3="sref">s3q sctepsmp_seq_foeti).sctepsmp_seq_opow),. 3"+codcoop3" class="srefcoo>i-&3 =2<37 L40" class="line" nam 2 nere"q" class.c2#L37" id 2 L37" class="line"q" class.c2#L37" id 2 L37" class="line"q" class.c2#L37" id 2 href=aa>;.375ep_hashtabfiepsmp_seq_open" clclass="srefcewn>i(s 2 L30" class="line" nam 7/a>.NULL;. dle2/,a> 25L16" id L26" class="line" nam 07ctp/p799a" clp href="net/sc#L43" id 2 L43" class="line" nam 2 L3oass="sre3s="srefcoo>isc2cnleentvs for 'snmp' object. */, ss="line"a" clpr>, pr_cq_rvaEM(net *&quo E3DPT 38ctclaociera le *s " =2{.1101 >(s3INODE LAD3RSld\n";.nroc.c##L11" id LL11" class="line" n L12"12 12;.pr_cq_rvaEM(&quo9;snms", net-&3odcoops" 3lass="srefcoo>i;.(staa" clproc.c nam 2LL"line" nam 2 L47"24 87 3ss="line"3nam 1 L83"12 83}.sctp_snmp_seq_fops);.se3_file *i).v).{.}.pr_n_n_e=sctp" c3ass="line3 nam 1 L88"18 58;. .a" clp href="net/sc#L43" id 2 L43" class="line" nam 2 L3odcoops" 3lass="srefcoo>i)., , pr_cq_rvaEM(net *39sctpocaa_bh_disabfile" class="class="line" nam 1 L23"12 23pr_cq_rvaEM(&quo9;snms", 3de=NULL" 3lass="sref">NULL;..pr_n_n_e=sctp" c31#L95" id31 L95" class="line" nam 31 L9539xpoet tp/proc.c1#L8" id 1 L89" class="l/=22 85roc.c2#L36" id 2 L36" class="l/=22 85roc.c2#L36proc.oc.c2#L14" id 2LL14" c"line" nam 1 L71"17 81stati, voidct2sctepsmp_seqtapoow(struct2seq_file *}. srefpoff_iet *.;. *i).se4_file *v)..scthashbuck_net" class4"sref40net-r78" id 1 L78" class="line" nam 1 L78"17 58# id 2 L31" class="line" nam 42sctep_="coopen" cl4ss="s40t/sctp/proc.c1#L73" id 1 L83" cl4ruct2;.i). seq_ s="sr_ID HB_ACT RTO MAX_PATH_RTXsr REM_seq__RTXs START (.}.pr_n_n_e=sctp" c4" class="4ine" nam 2 L10"21087stati, voidct2sctepsmp_seq_show(struct2sctepsmp_seqtapoow(struct2seq_file *net *{. *i).}., stati, voidct2sctepsmp_seq_show(struct2 *net *->4stati, voidct2sctepsmp_seq_show(struct2 *file *;.{. >(struct2(le * >(struc4ref">seq_4rintf(seq_file * >(struc4r>, ;.seq_fien_"ocele *;. >4oceow >4o\t#lu4"l23aexpo_a admp_list" c4ass="43ib" class="srle * c in -&g4aa_bh_enabfiow;.}.;. * return 0;.i).}.}. seq_4" class="srefe neow;. seq_fien_}.scts f_each_he=enttf(;./sctp/proc.c2#703" id 2 L17" class="line" nam 2 L17"21 87 href="+codn_n_=seq" class="srefn_n_=stf((sc4epsmp_seq_show),.seq).4s="line" 4am 2 L40"24 70};. *}.-> /4 Init44="sref"oceei_uidtf, file).fi4e44et/sctp/proc.c1#L16" id Laaaaaaaaaaaaaaaaaaaaaaaaa*43" id 2 L43" class="line" nam 2 L4eef">seq_4 siziofa>(st4uct2<44class="srefepmet-ctepsm_ff="net/sctp/protsL18" id 2 L38" ctsLine"etf((;.seq_fien_ntf(ctepsm_ff="net/sctp/pro continuea>;. }.file_opera vs 4a hre45ib" class="srefepetopen 4=2 a>((().sc4epsmp_ry" class2"sref">s4tRetr45et/sctp/proc.c2#503" +codcrim p/proc.c1#L20" id 1 L20 seq_4>sc4cntf"45a> dle2/,a> 25L16" id Laaaaaaaaaaaaaaaaaaaaaaaaa* N{te: 1a =Active, 0a =Inactive ;.;. a>(;.(i.<4 href46 SOCK STY SST HBKT LPORT UID4ode=open"4am 2 12 612 a> 4 46"sref"etp_sti>i, 46href=tp/proc.c1#L16" id Laaaaaaaaaaaaaaaaaaaaaaaaa* Res="limit time out (RTO) a>((seq4printf(;.seq_4 adtf( dle2/,a> 25L16" id Laaaaaaaaaaaaaaaaaaaaaaaaa* Maximum path res="limit count (PATH_MAX_RTX) a>}.;. a>((}.s4q i, 475ep_htp/proc.c2#L12" id 2 Laaaaaaaaaaaaaaaaaaaaaaaaa* so lets just leave it as zero12 90linemoid 2 seq4lass="sref">NULL;.;. 0 iseq_fien_ntf(ctepsm_ffp/proc.c1#L20" id 1 L20 &quo E4DPT 48"+codtp/proc.c1#L20" id 1 Laaaaaaaaaaaaaaaaaaaaaaaaa* currd 1ly impleid 1ed, but we cprorecord it with a s4RSld\n";.(;. 0 }.se4_file *(;. v).{.}.;.-> a>}. 49t/sctp/proc.c1#L73" id 1 L83" cl4de=NULL" 4lass="sref">NULL;..pr_n_n_e=sctp" c41#L95" id41 L95" class="line" nam 41 L9549xpoet tp/proc.c2#L24" id 2 L34" class="line" nam 2 L34"23 84}.sta/=22 85rnamss="a ="+codeinode" class=srefreadt4ss="line"4nam 1 L96"12 96}.sctepsm_foet.sctepsmp_seqtapoow),.sctepsmp_see neow),. sctepsmp_seqtocow),.sctep_="coopen" cl5ss="s50fel>itp/proc.c2#L12" id 2 L42" class="line" nam 1 L20"12 90./=22 85 href="net/sc#L43" id 2 L43" class="line" nam 2 L5ruct2pr_cq_rvaEM(seq, void *pr_cq_rvaEM(&quo9;snms", 5"srefhash5i(.static int2sctepsmp_seq_opow(struct2inode *net * return sta/=22 85rnamss="h"+codaaocen" class="srefaao5Mref="+co5tep_hashtabfile" class="5ref"=51"srefbindtc ad>i.sctepsm_foet),. 5am 2 L13521 73 .sta/=22 85roc.c namss="a ="+codeinode" class=srefreadt5srefepet<5 =2sctepsmp_seq_foet),.sctepsmp_seq_op/>),. 5a>, ;...-&g5;->5sc2cnleentvs for 'snmp' object. */ss="line"/=22 85r>, pr_cq_rvaEM(, *s " =2{.1101 >(s5codeeek" 5lass="sref"ket;.(;.pr_cq_rvaEM(&quo9;snms", net-&5ref">seq_5rintf(sta/=22 85roc.c namss=""line" nam 2 L47"24 87 5r>, ;.sctp_snmp_seq_fops);. if (> *i).-&g5aa_bh_enabfiow;.}. The original LXR software by"linecode=sen_http://sourceforge.n_e=te"et/ss/lxr">LXR 2" iu" iyp/pr_cthis ext/siid 2al verslas by"code=sen_mailto:lxr@f="ux.noid xr@f="ux.no xr.f="ux.no kindly hosted by"code=sen_http://www.redpill-f="te".noidRedpill L="te" ASp/pr_cte"vider of L="uxc.c2#ult L1 and2"24 12;.service;.since 1995.