小编Ric*_*rin的帖子

禁用 Linux 内核空间的反向路径过滤

在 Linux 内核模块中,我需要以某种方式禁用 rp_filter。这通常可以通过几个简单的 sysctl 调用从用户空间实现:

sysctl net.ipv4.conf.all.rp_filter=0
sysctl net.ipv4.conf.[ifname].rp_filter=0
Run Code Online (Sandbox Code Playgroud)

如何从内核空间获得相同的结果?我的第一个想法是我可能需要写入相关的 proc 文件。如果是这样,正确的方法是什么?

linux linux-kernel

5
推荐指数
1
解决办法
1万
查看次数

故意隐藏重载功能警告避免

考虑以下C++示例main.cpp文件:

class FooIf
{
public:
    virtual int handle(char *req, char *res) = 0;
};

class BarIf
{
public:

    virtual void handle(char *msg) = 0;
};

class Bar : private BarIf
{
private:
    void handle(char * msg){}
};

class Zoo : public FooIf, public Bar
{
public:
    using FooIf::handle;
public:
    int handle(char *req, char *res){ return (0); }
};

int main(){

    Zoo zoo;
    return (0);
}
Run Code Online (Sandbox Code Playgroud)

我收到这个警告:

$ clang++ -ggdb -c main.cpp -Wall
main.cpp:23:6: warning: 'Zoo::handle' hides overloaded virtual …
Run Code Online (Sandbox Code Playgroud)

c++ hidden warnings overloading clang

0
推荐指数
1
解决办法
598
查看次数

标签 统计

c++ ×1

clang ×1

hidden ×1

linux ×1

linux-kernel ×1

overloading ×1

warnings ×1