diff --git a/oaf/src/af_client_fs.c b/oaf/src/af_client_fs.c index 01306c5..f42020e 100755 --- a/oaf/src/af_client_fs.c +++ b/oaf/src/af_client_fs.c @@ -149,6 +149,8 @@ static int af_client_open(struct inode *inode, struct file *file) return 0; } + +#if LINUX_VERSION_CODE <= KERNEL_VERSION(5,5,0) static const struct file_operations af_client_fops = { .owner = THIS_MODULE, .open = af_client_open, @@ -156,7 +158,15 @@ static const struct file_operations af_client_fops = { .llseek = seq_lseek, .release = seq_release_private, }; - +#else +static const struct proc_ops af_client_fops = { + .proc_flags = PROC_ENTRY_PERMANENT, + .proc_read = seq_read, + .proc_open = af_client_open, + .proc_lseek = seq_lseek, + .proc_release = seq_release_private, +}; +#endif #define AF_CLIENT_PROC_STR "af_client" @@ -165,7 +175,10 @@ int init_af_client_procfs(void) { struct proc_dir_entry *pde; struct net *net = &init_net; - pde = proc_create(AF_CLIENT_PROC_STR, 0440, net->proc_net, &af_client_fops); + // pde = proc_create(AF_CLIENT_PROC_STR, 0440, net->proc_net, &af_client_fops); + + pde = proc_create(AF_CLIENT_PROC_STR, 0440, net->proc_net, &af_client_fops); + if (!pde) { AF_ERROR("nf_client proc file created error\n"); return -1; diff --git a/oaf/src/app_filter.c b/oaf/src/app_filter.c index afebd33..6f081b1 100755 --- a/oaf/src/app_filter.c +++ b/oaf/src/app_filter.c @@ -299,15 +299,19 @@ void load_feature_buf_from_file(char **config_buf) filp_close(fp, NULL); return; } + +#if LINUX_VERSION_CODE <= KERNEL_VERSION(5,7,19) fs = get_fs(); set_fs(KERNEL_DS); +#endif + // 4.14rc3 vfs_read-->kernel_read #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) kernel_read(fp, *config_buf, size, &(fp->f_pos)); #else vfs_read(fp, *config_buf, size, &(fp->f_pos)); #endif - set_fs(fs); +/// set_fs(fs); filp_close(fp, NULL); } diff --git a/open-app-filter/src/appfilter_ubus.c b/open-app-filter/src/appfilter_ubus.c index 450acf7..bbfb500 100755 --- a/open-app-filter/src/appfilter_ubus.c +++ b/open-app-filter/src/appfilter_ubus.c @@ -512,9 +512,13 @@ static void appfilter_add_object(struct ubus_object *obj) int appfilter_ubus_init(void) { - ubus_ctx = ubus_connect("/var/run/ubus.sock"); - if (!ubus_ctx) - return -EIO; + ubus_ctx = ubus_connect("/var/run/ubus/ubus.sock"); + if (!ubus_ctx){ + ubus_ctx = ubus_connect("/var/run/ubus.sock"); + } + if (!ubus_ctx){ + return -EIO; + } appfilter_add_object(&main_object); ubus_add_uloop(ubus_ctx);