当apt-get dist-upgrade在 Windows 10 Spring Creators Update (RS4) 上运行 Ubuntu 18.04 时,我收到此错误:
Preparing to unpack .../ebtables_2.0.10.4-3.5ubuntu2.18.04.1_amd64.deb ...
invoke-rc.d: could not determine current runlevel
* Error: insufficient privileges to access the ebtables rulesets.
invoke-rc.d: initscript ebtables, action "stop" failed.
dpkg: warning: old ebtables package pre-removal script subprocess returned error exit status 1
dpkg: trying script from the new package instead ...
invoke-rc.d: could not determine current runlevel
* Error: insufficient privileges to access the ebtables rulesets.
invoke-rc.d: initscript ebtables, …Run Code Online (Sandbox Code Playgroud) 基本上,我想编写一个内核模块,为ebtables添加一个可能的过滤器.然后我需要告诉ebtables在我设置的桥上使用我的过滤器.
我需要编写自己的模块的原因是我想在连续的包之间引入延迟(出于某些测试原因).为了演示,我的网络最初有这样的流量:
+++-----------------+++-----------------+++-----------------+++-----------------
Run Code Online (Sandbox Code Playgroud)
其中+显示了包裹的流量,并且-表示没有包裹在线上.我想在它们之间放置一个桥接器,以便数据包的模式将改变为:
+----+----+---------+----+----+---------+----+----+---------+----+----+---------
Run Code Online (Sandbox Code Playgroud)
这意味着我会确保每个数据包到达之间会有一定的延迟.
现在我编写了以下简单的代码,我基本上从linux-source/net/bridge/netfilter/ebt_ip.c中获取:
static bool match(const struct sk_buff *skb, const struct xt_match_param *par)
{
printk(KERN_INFO"match called\n");
return true; // match everything!
}
static bool check(const struct xt_mtchk_param *par)
{
printk(KERN_INFO"check called\n");
return true; // pass everything!
}
static struct xt_match reg __read_mostly = {
.name = "any", // I made this up, but I tried also putting ip for example which didn't change anything.
.revision = 0,
.family = NFPROTO_BRIDGE,
.match = …Run Code Online (Sandbox Code Playgroud)