SNMPv2 udpInDatagrams counter error
Subsystems (2)
Yes, you are right.
I also send the same mail several ago, and get no response. You patch is fine. But I think following code has no effect:
if (sk->sk_filter && skb->ip_summed != CHECKSUM_UNNECESSARY) {
It just let UDP datagrams with checksum error be added into UDP receive queue, and then discard it. I think this can be used to capture a UDP datagrams use a filter. But I if use a filter to capture a UDP datagrams, the code should like that:
if (!sk->sk_filter && skb->ip_summed != CHECKSUM_UNNECESSARY) {
IPv6 doesn't do this, so I think delete condition 'sk->sk_filter' is better. Do you think so?
Specially, do you try to send UDP datagrams with checksum error to echo- udp(port 7), may be your patch will let neither udpInDatagrams nor udpInErrors be increased. Because in my test, that datagrams can be send to echo-udp and get a echo reply.
----- Original Message -----
From: "Gerrit Renker" <[email protected]>
To: <[email protected]>
Sent: Monday, July 31, 2006 4:19 PM
Subject: Re: [PATCH] SNMPv2 udpInDatagrams counter error
Quoted 1 line
This has been raised earlier, cf.
http://bugzilla.kernel.org/show_bug.cgi?id=6660
Quoted 3 lines
Wei Yongjun wrote:
| When I send a UDP datagrams with checksum error to target, I found
that:
Quoted 2 lines
| Under IPv6, counter udpInErrors increased, but under IPv4 counter | udpInDatagrams increased. I lookup into the source code, and found
that,
Quoted 1 line
| under IPv4 UDP datagrams with checksum error will be delivered to
UDP
Quoted 1 line
| receive queue, but IPv6 does not. IPv4 delivered into UDP receive
queue,
Quoted 1 line
| increased udpInDatagrams, then discard it before delivered to UDP
user.
Quoted 1 line
| RFC said udpInDatagrams is the total number of UDP datagrams
delivered
Quoted 24 lines
| to UDP users, so udpInDatagrams should not be increased while UDP
| datagrams with checksum error received.
|
| Refer to RFC2013:
| udpInDatagrams OBJECT-TYPE
| SYNTAX Counter32
| MAX-ACCESS read-only
| STATUS current
| DESCRIPTION
| "The total number of UDP datagrams delivered to UDP
| users."
| ::= { udp 1 }
|
| Following is my patch:
|
| --- a/net/ipv4/udp.c 2006-07-31 09:33:45.392479344 -0400
| +++ b/net/ipv4/udp.c 2006-07-31 09:34:26.430240656 -0400
| @@ -1018,7 +1018,7 @@ static int udp_queue_rcv_skb(struct sock
| /* FALLTHROUGH -- it's a UDP Packet */
| }
|
| - if (sk->sk_filter && skb->ip_summed != CHECKSUM_UNNECESSARY) {
| + if (skb->ip_summed != CHECKSUM_UNNECESSARY) {
| if (__udp_checksum_complete(skb)) {Quoted 8 lines
| UDP_INC_STATS_BH(UDP_MIB_INERRORS); | kfree_skb(skb); | | Signed-off-by: Wei Yongjun <[email protected]> | | | - | To unsubscribe from this list: send the line "unsubscribe netdev"
in
Quoted 9 lines
| the body of a message to [email protected] | More majordomo info at http://vger.kernel.org/majordomo-info.html | |-
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 8 lines · Wei Yongjun
I also send the same mail several ago, and get no response. You patch is fine. But I think following code has no effect:
if (
sk->sk_filter&&skb->ip_summed!=CHECKSUM_UNNECESSARY) {It just let UDP datagrams with checksum error be added into UDP receive queue, and then discard it. I think this can be used to capture a UDP
We normally postpone the checksum computation until the user does a recv(2). However, if there is a socket filter attached then we need to verify the checksum right now because the socket filter will be applied at the very next step.
So yes it does let UDP datagrams with checksum errors onto the UDP rcv queue if there no socket filters attached, but this is intentional since we want to postpone the cost of checksum computation until the point when we have to copy the data to user-space where it becomes much cheaper.
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt