@@ -35,7 +35,15 @@ func (smbinfo *SMBInfo) TotalSessions() int {
35
35
}
36
36
37
37
func (smbinfo * SMBInfo ) TotalTreeCons () int {
38
- return len (smbinfo .smbstat .TCons )
38
+ total := 0
39
+ for _ , tcon := range smbinfo .smbstat .TCons {
40
+ serviceID := tcon .Service
41
+ if isInternalServiceID (serviceID ) {
42
+ continue
43
+ }
44
+ total ++
45
+ }
46
+ return total
39
47
}
40
48
41
49
func (smbinfo * SMBInfo ) TotalOpenFiles () int {
@@ -79,6 +87,9 @@ func (smbinfo *SMBInfo) MapServiceToTreeCons() map[string][]*SMBStatusTreeCon {
79
87
ret := map [string ][]* SMBStatusTreeCon {}
80
88
for _ , tcon := range smbinfo .smbstat .TCons {
81
89
serviceID := tcon .Service
90
+ if isInternalServiceID (serviceID ) {
91
+ continue
92
+ }
82
93
tconRef := & tcon
83
94
ret [serviceID ] = append (ret [serviceID ], tconRef )
84
95
}
@@ -88,6 +99,10 @@ func (smbinfo *SMBInfo) MapServiceToTreeCons() map[string][]*SMBStatusTreeCon {
88
99
func (smbinfo * SMBInfo ) MapMachineToTreeCons () map [string ][]* SMBStatusTreeCon {
89
100
ret := map [string ][]* SMBStatusTreeCon {}
90
101
for _ , tcon := range smbinfo .smbstat .TCons {
102
+ serviceID := tcon .Service
103
+ if isInternalServiceID (serviceID ) {
104
+ continue
105
+ }
91
106
machineID := tcon .Machine
92
107
tconRef := & tcon
93
108
ret [machineID ] = append (ret [machineID ], tconRef )
@@ -99,6 +114,9 @@ func (smbinfo *SMBInfo) MapServiceToMachines() map[string]map[string]int {
99
114
ret := map [string ]map [string ]int {}
100
115
for _ , tcon := range smbinfo .smbstat .TCons {
101
116
serviceID := tcon .Service
117
+ if isInternalServiceID (serviceID ) {
118
+ continue
119
+ }
102
120
machineID := tcon .Machine
103
121
sub , found := ret [serviceID ]
104
122
if ! found {
@@ -114,6 +132,9 @@ func (smbinfo *SMBInfo) MapMachineToServies() map[string]map[string]int {
114
132
ret := map [string ]map [string ]int {}
115
133
for _ , tcon := range smbinfo .smbstat .TCons {
116
134
serviceID := tcon .Service
135
+ if isInternalServiceID (serviceID ) {
136
+ continue
137
+ }
117
138
machineID := tcon .Machine
118
139
sub , found := ret [machineID ]
119
140
if ! found {
@@ -124,3 +145,7 @@ func (smbinfo *SMBInfo) MapMachineToServies() map[string]map[string]int {
124
145
}
125
146
return ret
126
147
}
148
+
149
+ func isInternalServiceID (serviceID string ) bool {
150
+ return serviceID == "IPC$"
151
+ }
0 commit comments