aboutgitcodebugslistschat
path: root/icmp.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2024-02-19 18:56:46 +1100
committerStefano Brivio <sbrivio@redhat.com>2024-02-27 12:52:02 +0100
commit4e08d9b9c6289ee00687203ce7a08106e9d45dc6 (patch)
tree539f1b4c53648effe241f424967bd8047fa3d0ab /icmp.c
parent1e6f92b995a9f7bff83b8b7a4b51782804fc23c5 (diff)
downloadpasst-4e08d9b9c6289ee00687203ce7a08106e9d45dc6.tar
passt-4e08d9b9c6289ee00687203ce7a08106e9d45dc6.tar.gz
passt-4e08d9b9c6289ee00687203ce7a08106e9d45dc6.tar.bz2
passt-4e08d9b9c6289ee00687203ce7a08106e9d45dc6.tar.lz
passt-4e08d9b9c6289ee00687203ce7a08106e9d45dc6.tar.xz
passt-4e08d9b9c6289ee00687203ce7a08106e9d45dc6.tar.zst
passt-4e08d9b9c6289ee00687203ce7a08106e9d45dc6.zip
treewide: Use sa_family_t for address family variables
Sometimes we use sa_family_t for variables and parameters containing a socket address family, other times we use a plain int. Since sa_family_t is what's actually used in struct sockaddr and friends, standardise on that. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'icmp.c')
-rw-r--r--icmp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/icmp.c b/icmp.c
index 9434fc5..faa38c8 100644
--- a/icmp.c
+++ b/icmp.c
@@ -62,7 +62,7 @@ static struct icmp_id_sock icmp_id_map[IP_VERSIONS][ICMP_NUM_IDS];
* @af: Address family (AF_INET or AF_INET6)
* @ref: epoll reference
*/
-void icmp_sock_handler(const struct ctx *c, int af, union epoll_ref ref)
+void icmp_sock_handler(const struct ctx *c, sa_family_t af, union epoll_ref ref)
{
struct icmp_id_sock *const id_sock = af == AF_INET
? &icmp_id_map[V4][ref.icmp.id] : &icmp_id_map[V6][ref.icmp.id];
@@ -156,7 +156,7 @@ static void icmp_ping_close(const struct ctx *c, struct icmp_id_sock *id_sock)
* Return: Newly opened ping socket fd, or -1 on failure
*/
static int icmp_ping_new(const struct ctx *c, struct icmp_id_sock *id_sock,
- int af, uint16_t id)
+ sa_family_t af, uint16_t id)
{
uint8_t proto = af == AF_INET ? IPPROTO_ICMP : IPPROTO_ICMPV6;
const char *const pname = af == AF_INET ? "ICMP" : "ICMPv6";
@@ -209,7 +209,7 @@ cancel:
*
* Return: count of consumed packets (always 1, even if malformed)
*/
-int icmp_tap_handler(const struct ctx *c, uint8_t pif, int af,
+int icmp_tap_handler(const struct ctx *c, uint8_t pif, sa_family_t af,
const void *saddr, const void *daddr,
const struct pool *p, const struct timespec *now)
{