Skip to content

Commit

Permalink
ipv4: Introduce ipip_offload_init helper function.
Browse files Browse the repository at this point in the history
It's convenient to init ipip offload. We will check
the return value, and print KERN_CRIT info on failure.

Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Tonghao Zhang authored and David S. Miller committed Aug 3, 2017
1 parent eb48d68 commit 93b1b31
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion net/ipv4/af_inet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1765,6 +1765,11 @@ static const struct net_offload ipip_offload = {
},
};

static int __init ipip_offload_init(void)
{
return inet_add_offload(&ipip_offload, IPPROTO_IPIP);
}

static int __init ipv4_offload_init(void)
{
/*
Expand All @@ -1774,9 +1779,10 @@ static int __init ipv4_offload_init(void)
pr_crit("%s: Cannot add UDP protocol offload\n", __func__);
if (tcpv4_offload_init() < 0)
pr_crit("%s: Cannot add TCP protocol offload\n", __func__);
if (ipip_offload_init() < 0)
pr_crit("%s: Cannot add IPIP protocol offload\n", __func__);

dev_add_offload(&ip_packet_offload);
inet_add_offload(&ipip_offload, IPPROTO_IPIP);
return 0;
}

Expand Down

0 comments on commit 93b1b31

Please sign in to comment.