Skip to content

Commit 0bb4883

Browse files
committed
Document process_icmp4() and process_icmp6()
1 parent 94d411e commit 0bb4883

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

counter.c

+31
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,20 @@ static inline void process_udp_recv(struct sk_buff *skb, statkey *key,
469469
key->pid = pid;
470470
}
471471

472+
/**
473+
* Process an ICMPv4 packet and populate the key with the relevant information.
474+
*
475+
* @param skb pointer to the socket buffer containing the ICMPv4 packet
476+
* @param key pointer to the statkey structure to be populated
477+
* @param pid process ID associated with the packet
478+
*
479+
* This function extracts source and destination IP addresses and ICMP type
480+
* and code from the ICMPv4 packet, taking into account the IPv4 header. It
481+
* stores these details in the provided statkey structure, along with the
482+
* protocol type set to ICMPv4 and the associated process ID.
483+
*
484+
* @throws none
485+
*/
472486
static inline size_t process_icmp4(struct sk_buff *skb, statkey *key,
473487
pid_t pid) {
474488
struct icmphdr *icmphdr =
@@ -501,6 +515,23 @@ static inline size_t process_icmp4(struct sk_buff *skb, statkey *key,
501515
return msglen;
502516
}
503517

518+
/**
519+
* Process an ICMPv6 packet and populate the key with the relevant information.
520+
*
521+
* @param skb pointer to the socket buffer containing the ICMPv6 packet
522+
* @param key pointer to the statkey structure to be populated
523+
* @param pid process ID associated with the packet
524+
*
525+
* This function extracts source and destination IP addresses and ICMPv6 type
526+
* and code from the ICMPv6 packet, taking into account the IPv6 header. It
527+
* stores these details in the provided statkey structure, along with the
528+
* protocol type set to ICMPv6 and the associated process ID. It also returns
529+
* the length of the ICMPv6 message payload.
530+
*
531+
* @return the length of the ICMPv6 message payload
532+
* @throws none
533+
*/
534+
504535
static inline size_t process_icmp6(struct sk_buff *skb, statkey *key,
505536
pid_t pid) {
506537
struct icmp6hdr *icmphdr =

0 commit comments

Comments
 (0)