mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-07 21:25:12 +02:00
ACCOUNT: annotate source where BE is used
This commit is contained in:
@@ -21,6 +21,7 @@
|
|||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
|
#include <linux/types.h>
|
||||||
#include <libxt_ACCOUNT_cl.h>
|
#include <libxt_ACCOUNT_cl.h>
|
||||||
|
|
||||||
bool exit_now;
|
bool exit_now;
|
||||||
|
@@ -54,8 +54,8 @@
|
|||||||
*/
|
*/
|
||||||
struct ipt_acc_table {
|
struct ipt_acc_table {
|
||||||
char name[ACCOUNT_TABLE_NAME_LEN];
|
char name[ACCOUNT_TABLE_NAME_LEN];
|
||||||
uint32_t ip;
|
__be32 ip;
|
||||||
uint32_t netmask;
|
__be32 netmask;
|
||||||
unsigned char depth;
|
unsigned char depth;
|
||||||
uint32_t refcount;
|
uint32_t refcount;
|
||||||
uint32_t itemcount;
|
uint32_t itemcount;
|
||||||
@@ -179,7 +179,7 @@ static void ipt_acc_data_free(void *data, unsigned char depth)
|
|||||||
|
|
||||||
/* Look for existing table / insert new one.
|
/* Look for existing table / insert new one.
|
||||||
Return internal ID or -1 on error */
|
Return internal ID or -1 on error */
|
||||||
static int ipt_acc_table_insert(char *name, uint32_t ip, uint32_t netmask)
|
static int ipt_acc_table_insert(char *name, __be32 ip, __be32 netmask)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
@@ -327,8 +327,8 @@ static void ipt_acc_destroy(const struct xt_tgdtor_param *par)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void ipt_acc_depth0_insert(struct ipt_acc_mask_24 *mask_24,
|
static void ipt_acc_depth0_insert(struct ipt_acc_mask_24 *mask_24,
|
||||||
uint32_t net_ip, uint32_t netmask,
|
__be32 net_ip, __be32 netmask,
|
||||||
uint32_t src_ip, uint32_t dst_ip,
|
__be32 src_ip, __be32 dst_ip,
|
||||||
uint32_t size, uint32_t *itemcount)
|
uint32_t size, uint32_t *itemcount)
|
||||||
{
|
{
|
||||||
unsigned char is_src = 0, is_dst = 0, src_slot, dst_slot;
|
unsigned char is_src = 0, is_dst = 0, src_slot, dst_slot;
|
||||||
@@ -401,8 +401,8 @@ static void ipt_acc_depth0_insert(struct ipt_acc_mask_24 *mask_24,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void ipt_acc_depth1_insert(struct ipt_acc_mask_16 *mask_16,
|
static void ipt_acc_depth1_insert(struct ipt_acc_mask_16 *mask_16,
|
||||||
uint32_t net_ip, uint32_t netmask,
|
__be32 net_ip, __be32 netmask,
|
||||||
uint32_t src_ip, uint32_t dst_ip,
|
__be32 src_ip, __be32 dst_ip,
|
||||||
uint32_t size, uint32_t *itemcount)
|
uint32_t size, uint32_t *itemcount)
|
||||||
{
|
{
|
||||||
/* Do we need to process src IP? */
|
/* Do we need to process src IP? */
|
||||||
@@ -439,8 +439,8 @@ static void ipt_acc_depth1_insert(struct ipt_acc_mask_16 *mask_16,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void ipt_acc_depth2_insert(struct ipt_acc_mask_8 *mask_8,
|
static void ipt_acc_depth2_insert(struct ipt_acc_mask_8 *mask_8,
|
||||||
uint32_t net_ip, uint32_t netmask,
|
__be32 net_ip, __be32 netmask,
|
||||||
uint32_t src_ip, uint32_t dst_ip,
|
__be32 src_ip, __be32 dst_ip,
|
||||||
uint32_t size, uint32_t *itemcount)
|
uint32_t size, uint32_t *itemcount)
|
||||||
{
|
{
|
||||||
/* Do we need to process src IP? */
|
/* Do we need to process src IP? */
|
||||||
@@ -481,8 +481,8 @@ static unsigned int ipt_acc_target(struct sk_buff **pskb, const struct xt_target
|
|||||||
const struct ipt_acc_info *info =
|
const struct ipt_acc_info *info =
|
||||||
par->targinfo;
|
par->targinfo;
|
||||||
|
|
||||||
uint32_t src_ip = ip_hdr(*pskb)->saddr;
|
__be32 src_ip = ip_hdr(*pskb)->saddr;
|
||||||
uint32_t dst_ip = ip_hdr(*pskb)->daddr;
|
__be32 dst_ip = ip_hdr(*pskb)->daddr;
|
||||||
uint32_t size = ntohs(ip_hdr(*pskb)->tot_len);
|
uint32_t size = ntohs(ip_hdr(*pskb)->tot_len);
|
||||||
|
|
||||||
spin_lock_bh(&ipt_acc_lock);
|
spin_lock_bh(&ipt_acc_lock);
|
||||||
|
@@ -35,8 +35,8 @@
|
|||||||
|
|
||||||
/* Structure for the userspace part of ipt_ACCOUNT */
|
/* Structure for the userspace part of ipt_ACCOUNT */
|
||||||
struct ipt_acc_info {
|
struct ipt_acc_info {
|
||||||
uint32_t net_ip;
|
__be32 net_ip;
|
||||||
uint32_t net_mask;
|
__be32 net_mask;
|
||||||
char table_name[ACCOUNT_TABLE_NAME_LEN];
|
char table_name[ACCOUNT_TABLE_NAME_LEN];
|
||||||
int32_t table_nr;
|
int32_t table_nr;
|
||||||
};
|
};
|
||||||
@@ -54,7 +54,7 @@ struct ipt_acc_handle_sockopt {
|
|||||||
Used for every IP when returning data
|
Used for every IP when returning data
|
||||||
*/
|
*/
|
||||||
struct ipt_acc_handle_ip {
|
struct ipt_acc_handle_ip {
|
||||||
uint32_t ip;
|
__be32 ip;
|
||||||
uint32_t src_packets;
|
uint32_t src_packets;
|
||||||
uint32_t src_bytes;
|
uint32_t src_bytes;
|
||||||
uint32_t dst_packets;
|
uint32_t dst_packets;
|
||||||
|
Reference in New Issue
Block a user