2
* author: Darren Bounds <dbounds@intrusense.com>
3
* copyright: Copyright (C) 2002 by Darren Bounds
4
* license: This software is under GPL version 2 of license
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
* 4g8 official page at http://.net
26
ipv4_hdr(struct libnet_ipv4_hdr *iphdr, u_int16_t prv_opts)
28
u_int8_t *s_addr, *d_addr;
31
fprintf(stdout, "DEBUG: ipv4_hdr()\n");
34
s_addr = malloc(sizeof(u_int8_t *));
35
d_addr = malloc(sizeof(u_int8_t *));
37
s_addr = libnet_addr2name4(iphdr->ip_src.s_addr, 0);
38
d_addr = libnet_addr2name4(iphdr->ip_dst.s_addr, 0);
40
fprintf(stdout, "IP header: Src Address: %s Dst Address: %s\n", s_addr, d_addr);
42
fprintf(stdout, "\t TTL: %d ID: %d TOS: 0x%X Len: %d ",
46
ntohs(iphdr->ip_len));
48
if(ntohs(iphdr->ip_off) & IP_DF)
49
fprintf(stdout, "(DF) ");
51
fprintf(stdout, "\n");
54
ntohs(iphdr->ip_len) - prv_opts,
68
fatal_error("Unable to build IP header: %s", libnet_geterror(pkt_d));