@@ -65,7 +65,7 @@ const char *socket_proto_name(unsigned int proto, char *nm, size_t size)
65
65
[IPPROTO_IPV6 ] = __stringify_1 (IPPROTO_IPV6 ), [IPPROTO_RSVP ] = __stringify_1 (IPPROTO_RSVP ),
66
66
[IPPROTO_GRE ] = __stringify_1 (IPPROTO_GRE ), [IPPROTO_ESP ] = __stringify_1 (IPPROTO_ESP ),
67
67
[IPPROTO_AH ] = __stringify_1 (IPPROTO_AH ), [IPPROTO_UDPLITE ] = __stringify_1 (IPPROTO_UDPLITE ),
68
- [IPPROTO_RAW ] = __stringify_1 (IPPROTO_RAW ),
68
+ [IPPROTO_RAW ] = __stringify_1 (IPPROTO_RAW ), [ IPPROTO_ICMPV6 ] = __stringify_1 ( IPPROTO_ICMPV6 ),
69
69
};
70
70
return __socket_const_name (nm , size , protos , ARRAY_SIZE (protos ), proto );
71
71
}
@@ -131,10 +131,12 @@ enum socket_cl_bits {
131
131
INET_UDP_CL_BIT ,
132
132
INET_UDPLITE_CL_BIT ,
133
133
INET_RAW_CL_BIT ,
134
+ INET_ICMP_CL_BIT ,
134
135
INET6_TCP_CL_BIT ,
135
136
INET6_UDP_CL_BIT ,
136
137
INET6_UDPLITE_CL_BIT ,
137
138
INET6_RAW_CL_BIT ,
139
+ INET6_ICMP_CL_BIT ,
138
140
UNIX_CL_BIT ,
139
141
PACKET_CL_BIT ,
140
142
_MAX_CL_BIT ,
@@ -161,6 +163,8 @@ static inline enum socket_cl_bits get_collect_bit_nr(unsigned int family, unsign
161
163
return INET_UDPLITE_CL_BIT ;
162
164
if (proto == IPPROTO_RAW )
163
165
return INET_RAW_CL_BIT ;
166
+ if (proto == IPPROTO_ICMP )
167
+ return INET_ICMP_CL_BIT ;
164
168
}
165
169
if (family == AF_INET6 ) {
166
170
if (proto == IPPROTO_TCP )
@@ -171,6 +175,8 @@ static inline enum socket_cl_bits get_collect_bit_nr(unsigned int family, unsign
171
175
return INET6_UDPLITE_CL_BIT ;
172
176
if (proto == IPPROTO_RAW )
173
177
return INET6_RAW_CL_BIT ;
178
+ if (proto == IPPROTO_ICMPV6 )
179
+ return INET6_ICMP_CL_BIT ;
174
180
}
175
181
176
182
pr_err ("Unknown pair family %d proto %d\n" , family , proto );
@@ -282,6 +288,12 @@ void preload_socket_modules(void)
282
288
req .r .i .sdiag_protocol = IPPROTO_RAW ;
283
289
probe_diag (nl , & req , - ENOENT );
284
290
291
+ req .r .i .sdiag_protocol = IPPROTO_ICMP ;
292
+ probe_diag (nl , & req , - ENOENT );
293
+
294
+ req .r .i .sdiag_protocol = IPPROTO_ICMPV6 ;
295
+ probe_diag (nl , & req , - ENOENT );
296
+
285
297
close (nl );
286
298
pr_info ("Done probing\n" );
287
299
}
@@ -773,6 +785,10 @@ static int inet_receive_one(struct nlmsghdr *h, struct ns_id *ns, void *arg)
773
785
case IPPROTO_RAW :
774
786
type = SOCK_RAW ;
775
787
break ;
788
+ case IPPROTO_ICMP :
789
+ case IPPROTO_ICMPV6 :
790
+ type = SOCK_DGRAM ;
791
+ break ;
776
792
default :
777
793
BUG_ON (1 );
778
794
return -1 ;
@@ -797,7 +813,7 @@ static int collect_err(int err, struct ns_id *ns, void *arg)
797
813
char family [32 ], proto [32 ];
798
814
char msg [256 ];
799
815
800
- snprintf (msg , sizeof (msg ), "Sockects collect procedure family %s proto %s" ,
816
+ snprintf (msg , sizeof (msg ), "Sockets collect procedure family %s proto %s" ,
801
817
socket_family_name (gr -> family , family , sizeof (family )),
802
818
socket_proto_name (gr -> protocol , proto , sizeof (proto )));
803
819
@@ -905,6 +921,13 @@ int collect_sockets(struct ns_id *ns)
905
921
if (tmp )
906
922
err = tmp ;
907
923
924
+ /* Collect IPv4 ICMP sockets */
925
+ req .r .i .sdiag_family = AF_INET ;
926
+ req .r .i .sdiag_protocol = IPPROTO_ICMP ;
927
+ req .r .i .idiag_ext = 0 ;
928
+ req .r .i .idiag_states = -1 ; /* All */
929
+ set_collect_bit (req .r .n .sdiag_family , req .r .n .sdiag_protocol );
930
+
908
931
/* Collect IPv6 TCP sockets */
909
932
req .r .i .sdiag_family = AF_INET6 ;
910
933
req .r .i .sdiag_protocol = IPPROTO_TCP ;
@@ -944,6 +967,13 @@ int collect_sockets(struct ns_id *ns)
944
967
if (tmp )
945
968
err = tmp ;
946
969
970
+ /* Collect IPv6 ICMP sockets */
971
+ req .r .i .sdiag_family = AF_INET6 ;
972
+ req .r .i .sdiag_protocol = IPPROTO_ICMPV6 ;
973
+ req .r .i .idiag_ext = 0 ;
974
+ req .r .i .idiag_states = -1 ; /* All */
975
+ set_collect_bit (req .r .n .sdiag_family , req .r .n .sdiag_protocol );
976
+
947
977
req .r .p .sdiag_family = AF_PACKET ;
948
978
req .r .p .sdiag_protocol = 0 ;
949
979
req .r .p .pdiag_show = PACKET_SHOW_INFO | PACKET_SHOW_MCLIST | PACKET_SHOW_FANOUT | PACKET_SHOW_RING_CFG ;
0 commit comments