Skip to content

Commit 9ef6b42

Browse files
Nazarov Sergeydavem330
authored andcommitted
net: Add __icmp_send helper.
Add __icmp_send function having ip_options struct parameter Signed-off-by: Sergey Nazarov <s-nazarov@yandex.ru> Reviewed-by: Paul Moore <paul@paul-moore.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent ecef67c commit 9ef6b42

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

include/net/icmp.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include <net/inet_sock.h>
2424
#include <net/snmp.h>
25+
#include <net/ip.h>
2526

2627
struct icmp_err {
2728
int errno;
@@ -39,7 +40,13 @@ struct net_proto_family;
3940
struct sk_buff;
4041
struct net;
4142

42-
void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info);
43+
void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info,
44+
const struct ip_options *opt);
45+
static inline void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
46+
{
47+
__icmp_send(skb_in, type, code, info, &IPCB(skb_in)->opt);
48+
}
49+
4350
int icmp_rcv(struct sk_buff *skb);
4451
int icmp_err(struct sk_buff *skb, u32 info);
4552
int icmp_init(void);

net/ipv4/icmp.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,8 @@ static struct rtable *icmp_route_lookup(struct net *net,
570570
* MUST reply to only the first fragment.
571571
*/
572572

573-
void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
573+
void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info,
574+
const struct ip_options *opt)
574575
{
575576
struct iphdr *iph;
576577
int room;
@@ -691,7 +692,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
691692
iph->tos;
692693
mark = IP4_REPLY_MARK(net, skb_in->mark);
693694

694-
if (ip_options_echo(net, &icmp_param.replyopts.opt.opt, skb_in))
695+
if (__ip_options_echo(net, &icmp_param.replyopts.opt.opt, skb_in, opt))
695696
goto out_unlock;
696697

697698

@@ -742,7 +743,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
742743
local_bh_enable();
743744
out:;
744745
}
745-
EXPORT_SYMBOL(icmp_send);
746+
EXPORT_SYMBOL(__icmp_send);
746747

747748

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

0 commit comments

Comments
 (0)