Sponsored Content
Top Forums Programming calculate IP Header checksum manually Post 302347078 by fpmurphy on Monday 24th of August 2009 09:37:30 PM
Old 08-24-2009
Best place to look for a detailed explanation is RFC 1071
 

9 More Discussions You Might Find Interesting

1. SCO

checksum

Does anyone know the answer to this? When I run "sum -r" on a file that I've down loaded from the sco website, the 1st set of numbers differs from the checksum on the download page but the 2nd set matches. If I try to install the patch, I get errors. Anyone has an answer? (3 Replies)
Discussion started by: jn5519
3 Replies

2. Linux

Reading the header of a tar file(posix header)

say i have these many file in a directory named exam. 1)/exam/newfolder/link.txt. 2)/exam/newfolder1/ and i create a tar say exam.tar well the problem is, when i read the tar file i dont find any metadata about the directories,as you cannot create a tar containig empty directories. on the... (2 Replies)
Discussion started by: Tanvirk
2 Replies

3. Shell Programming and Scripting

Renaming all header to specific header pattern

Input #HAC0253 EFVHIJHIJEFVTHIJOPKOPKTEFVEFVEFVOPKHIJOPKOPKHIJTTEFVEFVTEFV #BASFS12 EFVEFVHIJEFVEFVTOPKEFVOPKTHIJTTHIJOPK #ACG5115 TEFVEFVOIJEFVHIJHIJOPKOPKHIJHIJTTEFVEFVOPKTTEFVEFVOPKHIJOPKOPKOPK #ECG5114 IJTOPKHIJEFVOEFVEFVOPKTTEFVEFVOPKHIJOPKOPKOPK . . Output (5 Replies)
Discussion started by: patrick87
5 Replies

4. Shell Programming and Scripting

Calculate age of a file | calculate time difference

Hello, I'm trying to create a shell script (#!/bin/sh) which should tell me the age of a file in minutes... I have a process, which delivers me all 15 minutes a new file and I want to have a monitoring script, which sends me an email, if the present file is older than 20 minutes. To do... (10 Replies)
Discussion started by: worm
10 Replies

5. UNIX for Dummies Questions & Answers

Merge all csv files in one folder considering only 1 header row and ignoring header of all others

Friends, I need help with the following in UNIX. Merge all csv files in one folder considering only 1 header row and ignoring header of all other files. FYI - All files are in same format and contains same headers. Thank you (4 Replies)
Discussion started by: Shiny_Roy
4 Replies

6. IP Networking

Wireshark UDP checksum bad checksum

Hello I am communicating with two devices using my computer over UDP protocol. The application is running fine. When I monitored the UDP traffic using Wireshark software, I found that there were too many Checksum errors. Please find attached the png file showing this error. I am about to... (0 Replies)
Discussion started by: AustinCann
0 Replies

7. Shell Programming and Scripting

Add column header and row header

Hi, I have an input like this 1 2 3 4 2 3 4 5 4 5 6 7 I would like to count the no. of columns and print a header with a prefix "Col". I would also like to count the no. of rows and print as first column with each line number with a prefix "Row" So, my output would be ... (2 Replies)
Discussion started by: jacobs.smith
2 Replies

8. Shell Programming and Scripting

Manipulate all rows except header, but header should be output as well

Hello There... I have a sample input file .. number:department:amount 125:Market:125.23 126:Hardware store:434.95 127:Video store:7.45 128:Book store:14.32 129:Gasolline:16.10 I will be doing some manipulations on all the records except the header, but the header should always be... (2 Replies)
Discussion started by: juzz4fun
2 Replies

9. Shell Programming and Scripting

Find header in a text file and prepend it to all lines until another header is found

I've been struggling with this one for quite a while and cannot seem to find a solution for this find/replace scenario. Perhaps I'm getting rusty. I have a file that contains a number of metrics (exactly 3 fields per line) from a few appliances that are collected in parallel. To identify the... (3 Replies)
Discussion started by: verdepollo
3 Replies
IN_CKSUM(9)						   BSD Kernel Developer's Manual					       IN_CKSUM(9)

NAME
in_cksum, in4_cksum, in6_cksum -- compute Internet checksum SYNOPSIS
uint16_t in_cksum(struct mbuf *m, int len); uint16_t in4_cksum(struct mbuf *m, uint8_t nxt, int off, int len); uint16_t in6_cksum(struct mbuf *m, uint8_t nxt, int off, int len); DESCRIPTION
These functions are used to compute the ones-complement checksum required by IP and IPv6. The in4_cksum() function is used to compute the transport-layer checksum required by tcp(4) and udp(4) over a range of bytes starting at off and continuing on for len bytes within the mbuf m. If the nxt parameter is non-zero, it is assumed to be an IP protocol number. It is also assumed that the data within m starts with an IP header, and the transport-layer header starts at off; a pseudo-header is constructed as specified in RFC768 and RFC793, and the pseudo-header is prepended to the data covered by the checksum. The in6_cksum() function is similar; if nxt is non-zero, it is assumed that m starts with an IPv6 header, and that the transport-layer header starts after off bytes. The in_cksum() function is equivalent to in4_cksum(m, 0, 0, len). These functions are always performance critical and should be reimplemented in assembler or optimized C for each platform; when available, use of repeated full-width add-with-carry followed by reduction of the sum to a 16 bit width usually leads to best results. See RFC's 1071, 1141, 1624, and 1936 for more information about efficient computation of the internet checksum. RETURN VALUES
All three functions return the computed checksum value. SEE ALSO
inet(4), inet6(4), tcp(4), udp(4), protocols(5), mbuf(9) STANDARDS
These functions implement the Internet transport-layer checksum as specified in RFC768, RFC793, and RFC2460. BUGS
The in6_cksum() function currently requires special handling of link-local addresses in the pseudo-header due to the use of embedded scope- id's within link-local addresses. BSD
May 22, 2001 BSD
All times are GMT -4. The time now is 04:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy