Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
69f65fc6
Commit
69f65fc6
authored
May 25, 2003
by
David S. Miller
Browse files
Options
Browse Files
Download
Plain Diff
Merge
bk://kernel.bkbits.net/acme/net-2.5
into nuts.ninka.net:/home/davem/src/BK/net-2.5
parents
a8f8aaee
3cd30a1b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
82 deletions
+64
-82
net/ipv4/icmp.c
net/ipv4/icmp.c
+64
-82
No files found.
net/ipv4/icmp.c
View file @
69f65fc6
...
@@ -120,68 +120,68 @@ DEFINE_SNMP_STAT(struct icmp_mib, icmp_statistics);
...
@@ -120,68 +120,68 @@ DEFINE_SNMP_STAT(struct icmp_mib, icmp_statistics);
struct
icmp_err
icmp_err_convert
[]
=
{
struct
icmp_err
icmp_err_convert
[]
=
{
{
{
.
errno
=
ENETUNREACH
,
/* ICMP_NET_UNREACH */
.
errno
=
ENETUNREACH
,
/* ICMP_NET_UNREACH */
.
fatal
=
0
,
.
fatal
=
0
,
},
},
{
{
.
errno
=
EHOSTUNREACH
,
/* ICMP_HOST_UNREACH */
.
errno
=
EHOSTUNREACH
,
/* ICMP_HOST_UNREACH */
.
fatal
=
0
,
.
fatal
=
0
,
},
},
{
{
.
errno
=
ENOPROTOOPT
/* ICMP_PROT_UNREACH */
,
.
errno
=
ENOPROTOOPT
/* ICMP_PROT_UNREACH */
,
.
fatal
=
1
,
.
fatal
=
1
,
},
},
{
{
.
errno
=
ECONNREFUSED
,
/* ICMP_PORT_UNREACH */
.
errno
=
ECONNREFUSED
,
/* ICMP_PORT_UNREACH */
.
fatal
=
1
,
.
fatal
=
1
,
},
},
{
{
.
errno
=
EMSGSIZE
,
/* ICMP_FRAG_NEEDED */
.
errno
=
EMSGSIZE
,
/* ICMP_FRAG_NEEDED */
.
fatal
=
0
,
.
fatal
=
0
,
},
},
{
{
.
errno
=
EOPNOTSUPP
,
/* ICMP_SR_FAILED */
.
errno
=
EOPNOTSUPP
,
/* ICMP_SR_FAILED */
.
fatal
=
0
,
.
fatal
=
0
,
},
},
{
{
.
errno
=
ENETUNREACH
,
/* ICMP_NET_UNKNOWN */
.
errno
=
ENETUNREACH
,
/* ICMP_NET_UNKNOWN */
.
fatal
=
1
,
.
fatal
=
1
,
},
},
{
{
.
errno
=
EHOSTDOWN
,
/* ICMP_HOST_UNKNOWN */
.
errno
=
EHOSTDOWN
,
/* ICMP_HOST_UNKNOWN */
.
fatal
=
1
,
.
fatal
=
1
,
},
},
{
{
.
errno
=
ENONET
,
/* ICMP_HOST_ISOLATED */
.
errno
=
ENONET
,
/* ICMP_HOST_ISOLATED */
.
fatal
=
1
,
.
fatal
=
1
,
},
},
{
{
.
errno
=
ENETUNREACH
,
/* ICMP_NET_ANO */
.
errno
=
ENETUNREACH
,
/* ICMP_NET_ANO */
.
fatal
=
1
,
.
fatal
=
1
,
},
},
{
{
.
errno
=
EHOSTUNREACH
,
/* ICMP_HOST_ANO */
.
errno
=
EHOSTUNREACH
,
/* ICMP_HOST_ANO */
.
fatal
=
1
,
.
fatal
=
1
,
},
},
{
{
.
errno
=
ENETUNREACH
,
/* ICMP_NET_UNR_TOS */
.
errno
=
ENETUNREACH
,
/* ICMP_NET_UNR_TOS */
.
fatal
=
0
,
.
fatal
=
0
,
},
},
{
{
.
errno
=
EHOSTUNREACH
,
/* ICMP_HOST_UNR_TOS */
.
errno
=
EHOSTUNREACH
,
/* ICMP_HOST_UNR_TOS */
.
fatal
=
0
,
.
fatal
=
0
,
},
},
{
{
.
errno
=
EHOSTUNREACH
,
/* ICMP_PKT_FILTERED */
.
errno
=
EHOSTUNREACH
,
/* ICMP_PKT_FILTERED */
.
fatal
=
1
,
.
fatal
=
1
,
},
},
{
{
.
errno
=
EHOSTUNREACH
,
/* ICMP_PREC_VIOLATION */
.
errno
=
EHOSTUNREACH
,
/* ICMP_PREC_VIOLATION */
.
fatal
=
1
,
.
fatal
=
1
,
},
},
{
{
.
errno
=
EHOSTUNREACH
,
/* ICMP_PREC_CUTOFF */
.
errno
=
EHOSTUNREACH
,
/* ICMP_PREC_CUTOFF */
.
fatal
=
1
,
.
fatal
=
1
,
},
},
};
};
...
@@ -320,8 +320,8 @@ static void icmp_out_count(int type)
...
@@ -320,8 +320,8 @@ static void icmp_out_count(int type)
* Checksum each fragment, and on the first include the headers and final
* Checksum each fragment, and on the first include the headers and final
* checksum.
* checksum.
*/
*/
int
int
icmp_glue_bits
(
void
*
from
,
char
*
to
,
int
offset
,
int
len
,
int
odd
,
icmp_glue_bits
(
void
*
from
,
char
*
to
,
int
offset
,
int
len
,
int
odd
,
struct
sk_buff
*
skb
)
struct
sk_buff
*
skb
)
{
{
struct
icmp_bxm
*
icmp_param
=
(
struct
icmp_bxm
*
)
from
;
struct
icmp_bxm
*
icmp_param
=
(
struct
icmp_bxm
*
)
from
;
unsigned
int
csum
;
unsigned
int
csum
;
...
@@ -334,8 +334,8 @@ icmp_glue_bits(void *from, char *to, int offset, int len, int odd, struct sk_buf
...
@@ -334,8 +334,8 @@ icmp_glue_bits(void *from, char *to, int offset, int len, int odd, struct sk_buf
return
0
;
return
0
;
}
}
static
void
static
void
icmp_push_reply
(
struct
icmp_bxm
*
icmp_param
,
icmp_push_reply
(
struct
icmp_bxm
*
icmp_param
,
struct
ipcm_cookie
*
ipc
,
struct
rtable
*
rt
)
struct
ipcm_cookie
*
ipc
,
struct
rtable
*
rt
)
{
{
struct
sk_buff
*
skb
;
struct
sk_buff
*
skb
;
...
@@ -353,8 +353,8 @@ icmp_push_reply(struct icmp_bxm *icmp_param, struct ipcm_cookie *ipc, struct rta
...
@@ -353,8 +353,8 @@ icmp_push_reply(struct icmp_bxm *icmp_param, struct ipcm_cookie *ipc, struct rta
csum
=
csum_add
(
csum
,
skb1
->
csum
);
csum
=
csum_add
(
csum
,
skb1
->
csum
);
}
}
csum
=
csum_partial_copy_nocheck
((
void
*
)
&
icmp_param
->
data
,
csum
=
csum_partial_copy_nocheck
((
void
*
)
&
icmp_param
->
data
,
(
char
*
)
icmph
,
icmp_param
->
head_len
,
(
char
*
)
icmph
,
csum
);
icmp_param
->
head_len
,
csum
);
icmph
->
checksum
=
csum_fold
(
csum
);
icmph
->
checksum
=
csum_fold
(
csum
);
skb
->
ip_summed
=
CHECKSUM_NONE
;
skb
->
ip_summed
=
CHECKSUM_NONE
;
ip_push_pending_frames
(
icmp_socket
->
sk
);
ip_push_pending_frames
(
icmp_socket
->
sk
);
...
@@ -728,20 +728,16 @@ static void icmp_redirect(struct sk_buff *skb)
...
@@ -728,20 +728,16 @@ static void icmp_redirect(struct sk_buff *skb)
ip
=
iph
->
daddr
;
ip
=
iph
->
daddr
;
switch
(
skb
->
h
.
icmph
->
code
&
7
)
{
switch
(
skb
->
h
.
icmph
->
code
&
7
)
{
case
ICMP_REDIR_NET
:
case
ICMP_REDIR_NET
:
case
ICMP_REDIR_NETTOS
:
case
ICMP_REDIR_NETTOS
:
/*
/*
* As per RFC recommendations now handle it as
* As per RFC recommendations now handle it as a host redirect.
* a host redirect.
*/
*/
case
ICMP_REDIR_HOST
:
case
ICMP_REDIR_HOST
:
case
ICMP_REDIR_HOSTTOS
:
case
ICMP_REDIR_HOSTTOS
:
ip_rt_redirect
(
skb
->
nh
.
iph
->
saddr
,
ip
,
skb
->
h
.
icmph
->
un
.
gateway
,
ip_rt_redirect
(
skb
->
nh
.
iph
->
saddr
,
iph
->
saddr
,
iph
->
tos
,
skb
->
dev
);
ip
,
skb
->
h
.
icmph
->
un
.
gateway
,
break
;
iph
->
saddr
,
iph
->
tos
,
skb
->
dev
);
break
;
default:
break
;
}
}
out:
out:
return
;
return
;
...
@@ -966,7 +962,7 @@ int icmp_rcv(struct sk_buff *skb)
...
@@ -966,7 +962,7 @@ int icmp_rcv(struct sk_buff *skb)
}
}
ICMP_INC_STATS_BH_FIELD
(
icmp_pointers
[
icmph
->
type
].
input_off
);
ICMP_INC_STATS_BH_FIELD
(
icmp_pointers
[
icmph
->
type
].
input_off
);
(
icmp_pointers
[
icmph
->
type
].
handler
)
(
skb
);
icmp_pointers
[
icmph
->
type
].
handler
(
skb
);
drop:
drop:
kfree_skb
(
skb
);
kfree_skb
(
skb
);
...
@@ -980,8 +976,7 @@ int icmp_rcv(struct sk_buff *skb)
...
@@ -980,8 +976,7 @@ int icmp_rcv(struct sk_buff *skb)
* This table is the definition of how we handle ICMP.
* This table is the definition of how we handle ICMP.
*/
*/
static
struct
icmp_control
icmp_pointers
[
NR_ICMP_TYPES
+
1
]
=
{
static
struct
icmp_control
icmp_pointers
[
NR_ICMP_TYPES
+
1
]
=
{
/* ECHO REPLY (0) */
[
ICMP_ECHOREPLY
]
=
{
[
0
]
=
{
.
output_off
=
offsetof
(
struct
icmp_mib
,
IcmpOutEchoReps
),
.
output_off
=
offsetof
(
struct
icmp_mib
,
IcmpOutEchoReps
),
.
input_off
=
offsetof
(
struct
icmp_mib
,
IcmpInEchoReps
),
.
input_off
=
offsetof
(
struct
icmp_mib
,
IcmpInEchoReps
),
.
handler
=
icmp_discard
,
.
handler
=
icmp_discard
,
...
@@ -998,22 +993,19 @@ static struct icmp_control icmp_pointers[NR_ICMP_TYPES + 1] = {
...
@@ -998,22 +993,19 @@ static struct icmp_control icmp_pointers[NR_ICMP_TYPES + 1] = {
.
handler
=
icmp_discard
,
.
handler
=
icmp_discard
,
.
error
=
1
,
.
error
=
1
,
},
},
/* DEST UNREACH (3) */
[
ICMP_DEST_UNREACH
]
=
{
[
3
]
=
{
.
output_off
=
offsetof
(
struct
icmp_mib
,
IcmpOutDestUnreachs
),
.
output_off
=
offsetof
(
struct
icmp_mib
,
IcmpOutDestUnreachs
),
.
input_off
=
offsetof
(
struct
icmp_mib
,
IcmpInDestUnreachs
),
.
input_off
=
offsetof
(
struct
icmp_mib
,
IcmpInDestUnreachs
),
.
handler
=
icmp_unreach
,
.
handler
=
icmp_unreach
,
.
error
=
1
,
.
error
=
1
,
},
},
/* SOURCE QUENCH (4) */
[
ICMP_SOURCE_QUENCH
]
=
{
[
4
]
=
{
.
output_off
=
offsetof
(
struct
icmp_mib
,
IcmpOutSrcQuenchs
),
.
output_off
=
offsetof
(
struct
icmp_mib
,
IcmpOutSrcQuenchs
),
.
input_off
=
offsetof
(
struct
icmp_mib
,
IcmpInSrcQuenchs
),
.
input_off
=
offsetof
(
struct
icmp_mib
,
IcmpInSrcQuenchs
),
icmp_unreach
,
.
handler
=
icmp_unreach
,
.
error
=
1
,
.
error
=
1
,
},
},
/* REDIRECT (5) */
[
ICMP_REDIRECT
]
=
{
[
5
]
=
{
.
output_off
=
offsetof
(
struct
icmp_mib
,
IcmpOutRedirects
),
.
output_off
=
offsetof
(
struct
icmp_mib
,
IcmpOutRedirects
),
.
input_off
=
offsetof
(
struct
icmp_mib
,
IcmpInRedirects
),
.
input_off
=
offsetof
(
struct
icmp_mib
,
IcmpInRedirects
),
.
handler
=
icmp_redirect
,
.
handler
=
icmp_redirect
,
...
@@ -1031,12 +1023,10 @@ static struct icmp_control icmp_pointers[NR_ICMP_TYPES + 1] = {
...
@@ -1031,12 +1023,10 @@ static struct icmp_control icmp_pointers[NR_ICMP_TYPES + 1] = {
.
handler
=
icmp_discard
,
.
handler
=
icmp_discard
,
.
error
=
1
,
.
error
=
1
,
},
},
/* ECHO (8) */
[
ICMP_ECHO
]
=
{
[
8
]
=
{
.
output_off
=
offsetof
(
struct
icmp_mib
,
IcmpOutEchos
),
.
output_off
=
offsetof
(
struct
icmp_mib
,
IcmpOutEchos
),
.
input_off
=
offsetof
(
struct
icmp_mib
,
IcmpInEchos
),
.
input_off
=
offsetof
(
struct
icmp_mib
,
IcmpInEchos
),
.
handler
=
icmp_echo
,
.
handler
=
icmp_echo
,
.
error
=
0
,
},
},
[
9
]
=
{
[
9
]
=
{
.
output_off
=
offsetof
(
struct
icmp_mib
,
dummy
),
.
output_off
=
offsetof
(
struct
icmp_mib
,
dummy
),
...
@@ -1050,56 +1040,48 @@ static struct icmp_control icmp_pointers[NR_ICMP_TYPES + 1] = {
...
@@ -1050,56 +1040,48 @@ static struct icmp_control icmp_pointers[NR_ICMP_TYPES + 1] = {
.
handler
=
icmp_discard
,
.
handler
=
icmp_discard
,
.
error
=
1
,
.
error
=
1
,
},
},
/* TIME EXCEEDED (11) */
[
ICMP_TIME_EXCEEDED
]
=
{
[
11
]
=
{
.
output_off
=
offsetof
(
struct
icmp_mib
,
IcmpOutTimeExcds
),
.
output_off
=
offsetof
(
struct
icmp_mib
,
IcmpOutTimeExcds
),
.
input_off
=
offsetof
(
struct
icmp_mib
,
IcmpInTimeExcds
),
.
input_off
=
offsetof
(
struct
icmp_mib
,
IcmpInTimeExcds
),
.
handler
=
icmp_unreach
,
.
handler
=
icmp_unreach
,
.
error
=
1
,
.
error
=
1
,
},
},
/* PARAMETER PROBLEM (12) */
[
ICMP_PARAMETERPROB
]
=
{
[
12
]
=
{
.
output_off
=
offsetof
(
struct
icmp_mib
,
IcmpOutParmProbs
),
.
output_off
=
offsetof
(
struct
icmp_mib
,
IcmpOutParmProbs
),
.
input_off
=
offsetof
(
struct
icmp_mib
,
IcmpInParmProbs
),
.
input_off
=
offsetof
(
struct
icmp_mib
,
IcmpInParmProbs
),
.
handler
=
icmp_unreach
,
.
handler
=
icmp_unreach
,
.
error
=
1
,
.
error
=
1
,
},
},
/* TIMESTAMP (13) */
[
ICMP_TIMESTAMP
]
=
{
[
13
]
=
{
.
output_off
=
offsetof
(
struct
icmp_mib
,
IcmpOutTimestamps
),
.
output_off
=
offsetof
(
struct
icmp_mib
,
IcmpOutTimestamps
),
.
input_off
=
offsetof
(
struct
icmp_mib
,
IcmpInTimestamps
),
.
input_off
=
offsetof
(
struct
icmp_mib
,
IcmpInTimestamps
),
.
handler
=
icmp_timestamp
,
.
handler
=
icmp_timestamp
,
},
},
/* TIMESTAMP REPLY (14) */
[
ICMP_TIMESTAMPREPLY
]
=
{
[
14
]
=
{
.
output_off
=
offsetof
(
struct
icmp_mib
,
IcmpOutTimestampReps
),
.
output_off
=
offsetof
(
struct
icmp_mib
,
IcmpOutTimestampReps
),
.
input_off
=
offsetof
(
struct
icmp_mib
,
IcmpInTimestampReps
),
.
input_off
=
offsetof
(
struct
icmp_mib
,
IcmpInTimestampReps
),
.
handler
=
icmp_discard
,
.
handler
=
icmp_discard
,
},
},
/* INFO (15) */
[
ICMP_INFO_REQUEST
]
=
{
[
15
]
=
{
.
output_off
=
offsetof
(
struct
icmp_mib
,
dummy
),
.
output_off
=
offsetof
(
struct
icmp_mib
,
dummy
),
.
input_off
=
offsetof
(
struct
icmp_mib
,
dummy
),
.
input_off
=
offsetof
(
struct
icmp_mib
,
dummy
),
.
handler
=
icmp_discard
,
.
handler
=
icmp_discard
,
},
},
/* INFO REPLY (16) */
[
ICMP_INFO_REPLY
]
=
{
[
16
]
=
{
.
output_off
=
offsetof
(
struct
icmp_mib
,
dummy
),
.
output_off
=
offsetof
(
struct
icmp_mib
,
dummy
),
.
input_off
=
offsetof
(
struct
icmp_mib
,
dummy
),
.
input_off
=
offsetof
(
struct
icmp_mib
,
dummy
),
.
handler
=
icmp_discard
,
.
handler
=
icmp_discard
,
},
},
/* ADDR MASK (17) */
[
ICMP_ADDRESS
]
=
{
[
17
]
=
{
.
output_off
=
offsetof
(
struct
icmp_mib
,
IcmpOutAddrMasks
),
.
output_off
=
offsetof
(
struct
icmp_mib
,
IcmpOutAddrMasks
),
.
input_off
=
offsetof
(
struct
icmp_mib
,
IcmpInAddrMasks
),
.
input_off
=
offsetof
(
struct
icmp_mib
,
IcmpInAddrMasks
),
.
handler
=
icmp_address
,
.
handler
=
icmp_address
,
},
},
/* ADDR MASK REPLY (18) */
[
ICMP_ADDRESSREPLY
]
=
{
[
18
]
=
{
.
output_off
=
offsetof
(
struct
icmp_mib
,
IcmpOutAddrMaskReps
),
.
output_off
=
offsetof
(
struct
icmp_mib
,
IcmpOutAddrMaskReps
),
.
input_off
=
offsetof
(
struct
icmp_mib
,
IcmpInAddrMaskReps
),
.
input_off
=
offsetof
(
struct
icmp_mib
,
IcmpInAddrMaskReps
),
.
handler
=
icmp_address_reply
,
.
handler
=
icmp_address_reply
,
}
}
,
};
};
void
__init
icmp_init
(
struct
net_proto_family
*
ops
)
void
__init
icmp_init
(
struct
net_proto_family
*
ops
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment