Skip to content

Commit

Permalink
net: Add __icmp_send helper.
Browse files Browse the repository at this point in the history
Add __icmp_send function having ip_options struct parameter

Signed-off-by: Sergey Nazarov <[email protected]>
Reviewed-by: Paul Moore <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Nazarov Sergey authored and davem330 committed Feb 25, 2019
1 parent ecef67c commit 9ef6b42
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
9 changes: 8 additions & 1 deletion include/net/icmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include <net/inet_sock.h>
#include <net/snmp.h>
#include <net/ip.h>

struct icmp_err {
int errno;
Expand All @@ -39,7 +40,13 @@ struct net_proto_family;
struct sk_buff;
struct net;

void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info);
void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info,
const struct ip_options *opt);
static inline void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
{
__icmp_send(skb_in, type, code, info, &IPCB(skb_in)->opt);
}

int icmp_rcv(struct sk_buff *skb);
int icmp_err(struct sk_buff *skb, u32 info);
int icmp_init(void);
Expand Down
7 changes: 4 additions & 3 deletions net/ipv4/icmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,8 @@ static struct rtable *icmp_route_lookup(struct net *net,
* MUST reply to only the first fragment.
*/

void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info,
const struct ip_options *opt)
{
struct iphdr *iph;
int room;
Expand Down Expand Up @@ -691,7 +692,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
iph->tos;
mark = IP4_REPLY_MARK(net, skb_in->mark);

if (ip_options_echo(net, &icmp_param.replyopts.opt.opt, skb_in))
if (__ip_options_echo(net, &icmp_param.replyopts.opt.opt, skb_in, opt))
goto out_unlock;


Expand Down Expand Up @@ -742,7 +743,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
local_bh_enable();
out:;
}
EXPORT_SYMBOL(icmp_send);
EXPORT_SYMBOL(__icmp_send);


static void icmp_socket_deliver(struct sk_buff *skb, u32 info)
Expand Down

0 comments on commit 9ef6b42

Please sign in to comment.