- 论坛徽章:
- 17
|
如果第一次使用 gre vport,open-vswitch注册了一个 gre_cisco_protocol,但是没有提供 err_handler。
见 gre_init()@net/openvswitch/vport-gre.c
static struct gre_cisco_protocol gre_protocol = {
.handler = gre_rcv,
.priority = 1,
};
static int gre_init(void)
{
int err;
gre_ports++;
if (gre_ports > 1)
return 0;
err = gre_cisco_register(&gre_protocol);
if (err)
pr_warn("cannot register gre protocol handler\n");
return err;
}
而 gre的错误处理流程中,不会检查 err_handler是否为空指针。然后内核就杯具了!
net/ipv4/gre_demux.c
static void gre_cisco_err(struct sk_buff *skb, u32 info)
{
......
for (i = 0; i < GRE_IP_PROTO_MAX; i++) {
struct gre_cisco_protocol *proto;
proto = rcu_dereference(gre_cisco_proto_list);
if (!proto)
continue;
if (proto->err_handler(skb, info, &tpi) == PACKET_RCVD)
goto out;
}
......
}
想请教的是 gre_cisco_protocol要求必须提供 err_handler? |
|