fix build problem upon kernel 4.17
This commit is contained in:
parent
b3e2557cab
commit
0f3cf09434
@ -132,8 +132,8 @@ void check_client_expire(void)
|
||||
AF_CLIENT_LOCK_W();
|
||||
for (i = 0; i < MAX_AF_CLIENT_HASH_SIZE; i++){
|
||||
list_for_each_entry(node, &af_client_list_table[i], hlist) {
|
||||
AF_DEBUG("mac:"MAC_FMT" update:%d cur:%d, interval:%d\n", MAC_ARRAY(node->mac),
|
||||
node->update_jiffies, HZ, (jiffies - node->update_jiffies) / HZ);
|
||||
AF_DEBUG("mac:"MAC_FMT" update:%lu interval:%lu\n", MAC_ARRAY(node->mac),
|
||||
node->update_jiffies, (jiffies - node->update_jiffies) / HZ);
|
||||
if (jiffies > (node->update_jiffies + MAX_CLIENT_ACTIVE_TIME * HZ)) {
|
||||
AF_INFO("del client:"MAC_FMT"\n", MAC_ARRAY(node->mac));
|
||||
list_del(&(node->hlist));
|
||||
@ -213,7 +213,8 @@ static u_int32_t nfclient_hook(unsigned int hook,
|
||||
AF_CLIENT_LOCK_W();
|
||||
nfc = find_af_client(smac);
|
||||
if (!nfc){
|
||||
AF_DEBUG("from dev:%s [%s] %pI4--->%pI4", skb->dev, (iph->protocol == IPPROTO_TCP ? "TCP" : "UDP"),
|
||||
if (skb->dev)
|
||||
AF_DEBUG("from dev:%s [%s] %pI4--->%pI4", skb->dev->name, (iph->protocol == IPPROTO_TCP ? "TCP" : "UDP"),
|
||||
&iph->saddr, &iph->daddr);
|
||||
nfc = nf_client_add(smac);
|
||||
}
|
||||
|
@ -276,14 +276,14 @@ void load_feature_buf_from_file(char **config_buf)
|
||||
|
||||
if(IS_ERR(fp)) {
|
||||
printk("open feature file failed\n");
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
|
||||
inode = fp->f_inode;
|
||||
size = inode->i_size;
|
||||
AF_INFO("feature file size: %d\n", size);
|
||||
AF_INFO("feature file size: %u\n", size);
|
||||
if (size == 0) {
|
||||
AF_WARN("warning, file size = %d\n", size);
|
||||
AF_WARN("warning, file size = %u\n", size);
|
||||
return;
|
||||
}
|
||||
*config_buf = (char *) kzalloc( sizeof(char) * size, GFP_KERNEL);
|
||||
@ -709,9 +709,16 @@ int app_filter_match(flow_info_t *flow)
|
||||
#define APP_FILTER_DROP_BITS 0xf0000000
|
||||
u_int32_t af_get_timestamp_sec(void)
|
||||
{
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,17,0)
|
||||
struct timespec64 ts;
|
||||
ktime_get_ts64(&ts);
|
||||
return (u_int32_t)ts.tv_sec;
|
||||
#else
|
||||
struct timespec ts;
|
||||
ts = current_kernel_time();
|
||||
return ts.tv_sec;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user