Skip to content

Commit

Permalink
Use kernel ipv6_addr_cmp function (#42)
Browse files Browse the repository at this point in the history
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
  • Loading branch information
cppcoffee authored May 22, 2023
1 parent 8da2098 commit 65acf92
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions module/src/state.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <linux/rculist.h>
#include <linux/timer.h>
#include <linux/version.h>
#include <net/ipv6.h>
#include "drawbridge.h"

/**
Expand All @@ -30,21 +31,6 @@ DEFINE_SPINLOCK(listmutex);
*/
struct timer_list *reaper;

/**
* @brief Utility function to compare IPv6 addresses
* @param a1 First address, of type in6_addr to compare
* @param a2 Second address, of type in6_addr to compare
* @return Zero on a match, otherwise a non-zero integer
*/
static inline int ipv6_addr_cmp(const struct in6_addr *a1,
const struct in6_addr *a2)
{
if (a2 == NULL || a1 == NULL) {
return -1;
}
return memcmp(a1, a2, sizeof(struct in6_addr));
}

/**
* @brief Utility function to compare state with parsed_packet
* @return Zero on a match, otherwise a non-zero integer
Expand Down

0 comments on commit 65acf92

Please sign in to comment.