Skip to content

Commit 826987f

Browse files
Nazarov Sergeygregkh
authored andcommitted
net: Add __icmp_send helper.
[ Upstream commit 9ef6b42 ] 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 51d2787 commit 826987f

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

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
void 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
@@ -565,7 +565,8 @@ static struct rtable *icmp_route_lookup(struct net *net,
565565
* MUST reply to only the first fragment.
566566
*/
567567

568-
void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
568+
void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info,
569+
const struct ip_options *opt)
569570
{
570571
struct iphdr *iph;
571572
int room;
@@ -679,7 +680,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
679680
iph->tos;
680681
mark = IP4_REPLY_MARK(net, skb_in->mark);
681682

682-
if (ip_options_echo(&icmp_param->replyopts.opt.opt, skb_in))
683+
if (__ip_options_echo(&icmp_param->replyopts.opt.opt, skb_in, opt))
683684
goto out_unlock;
684685

685686

@@ -731,7 +732,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
731732
kfree(icmp_param);
732733
out:;
733734
}
734-
EXPORT_SYMBOL(icmp_send);
735+
EXPORT_SYMBOL(__icmp_send);
735736

736737

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

0 commit comments

Comments
 (0)