Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 89811
b: refs/heads/master
c: a5710d6
h: refs/heads/master
i:
  89809: 436edf6
  89807: cddf18b
v: v3
  • Loading branch information
Denis V. Lunev authored and David S. Miller committed Feb 29, 2008
1 parent b5119cd commit b5eb89d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9b0f976f27f00a81cf47643d90854659626795b4
refs/heads/master: a5710d6582868a96cf0fe02eac11d34cfbc783c9
2 changes: 1 addition & 1 deletion trunk/include/net/icmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct sk_buff;
extern void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info);
extern int icmp_rcv(struct sk_buff *skb);
extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg);
extern void icmp_init(void);
extern int icmp_init(void);
extern void icmp_out_count(unsigned char type);

/* Move into dst.h ? */
Expand Down
3 changes: 2 additions & 1 deletion trunk/net/ipv4/af_inet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1430,7 +1430,8 @@ static int __init inet_init(void)
* Set the ICMP layer up
*/

icmp_init();
if (icmp_init() < 0)
panic("Failed to create the ICMP control socket.\n");

/*
* Initialise the multicast router
Expand Down
26 changes: 22 additions & 4 deletions trunk/net/ipv4/icmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1139,19 +1139,32 @@ static const struct icmp_control icmp_pointers[NR_ICMP_TYPES + 1] = {
},
};

void __init icmp_init(void)
static void __exit icmp_exit(void)
{
struct inet_sock *inet;
int i;

for_each_possible_cpu(i) {
int err;
struct socket *sock;

sock = per_cpu(__icmp_socket, i);
if (sock == NULL)
continue;
per_cpu(__icmp_socket, i) = NULL;
sock_release(sock);
}
}

int __init icmp_init(void)
{
struct inet_sock *inet;
int i, err;

for_each_possible_cpu(i) {
err = sock_create_kern(PF_INET, SOCK_RAW, IPPROTO_ICMP,
&per_cpu(__icmp_socket, i));

if (err < 0)
panic("Failed to create the ICMP control socket.\n");
goto fail;

per_cpu(__icmp_socket, i)->sk->sk_allocation = GFP_ATOMIC;

Expand All @@ -1171,6 +1184,11 @@ void __init icmp_init(void)
*/
per_cpu(__icmp_socket, i)->sk->sk_prot->unhash(per_cpu(__icmp_socket, i)->sk);
}
return 0;

fail:
icmp_exit();
return err;
}

EXPORT_SYMBOL(icmp_err_convert);
Expand Down

0 comments on commit b5eb89d

Please sign in to comment.