diff options
author | Sam Roberts <vieuxtech@gmail.com> | 2009-03-30 17:21:52 -0700 |
---|---|---|
committer | Sam Roberts <vieuxtech@gmail.com> | 2009-03-30 17:21:52 -0700 |
commit | 50bc98656a77b198f2e1183392d2846a04414f97 (patch) | |
tree | e298d6f0bad69ff8bf2568c0017a6b128e33d492 /libnet/sample | |
parent | a3694435cacc323efe6287747ae8778c17e897b1 (diff) | |
parent | 2c95ef83853c275d490418d653c111e91aac72b7 (diff) | |
download | libnet-50bc98656a77b198f2e1183392d2846a04414f97.tar.gz |
Merge branch 'v1.1.3-RC-01-fork' into merge-v1.1.3-misc
Conflicts:
libnet/autogen.sh
libnet/configure.in
libnet/doc/CHANGELOG
libnet/doc/CONTRIB
libnet/doc/PACKET_BUILDING
libnet/include/ifaddrlist.h
libnet/include/libnet/libnet-functions.h
libnet/include/libnet/libnet-headers.h
libnet/include/libnet/libnet-macros.h
libnet/include/libnet/libnet-structures.h
libnet/include/libnet/libnet-types.h
libnet/sample/Makefile.am
libnet/sample/arp.c
libnet/sample/bgp4_hdr.c
libnet/sample/cdp.c
libnet/sample/dhcp_discover.c
libnet/sample/fddi_tcp1.c
libnet/sample/fddi_tcp2.c
libnet/sample/get_addr.c
libnet/sample/icmp6_echoreq.c
libnet/sample/mpls.c
libnet/sample/ospf_hello.c
libnet/sample/rpc_tcp.c
libnet/sample/rpc_udp.c
libnet/sample/synflood.c
libnet/sample/synflood6.c
libnet/sample/synflood6_frag.c
libnet/sample/tcp1.c
libnet/sample/tcp2.c
libnet/sample/tring_tcp1.c
libnet/sample/tring_tcp2.c
libnet/sample/udp1.c
libnet/src/Makefile.am
libnet/src/libnet_advanced.c
libnet/src/libnet_build_802.1q.c
libnet/src/libnet_build_802.1x.c
libnet/src/libnet_build_802.2.c
libnet/src/libnet_build_802.3.c
libnet/src/libnet_build_arp.c
libnet/src/libnet_build_bgp.c
libnet/src/libnet_build_cdp.c
libnet/src/libnet_build_data.c
libnet/src/libnet_build_dns.c
libnet/src/libnet_build_ethernet.c
libnet/src/libnet_build_fddi.c
libnet/src/libnet_build_gre.c
libnet/src/libnet_build_icmp.c
libnet/src/libnet_build_igmp.c
libnet/src/libnet_build_ip.c
libnet/src/libnet_build_ipsec.c
libnet/src/libnet_build_isl.c
libnet/src/libnet_build_link.c
libnet/src/libnet_build_mpls.c
libnet/src/libnet_build_ntp.c
libnet/src/libnet_build_ospf.c
libnet/src/libnet_build_rip.c
libnet/src/libnet_build_rpc.c
libnet/src/libnet_build_sebek.c
libnet/src/libnet_build_stp.c
libnet/src/libnet_build_token_ring.c
libnet/src/libnet_build_udp.c
libnet/src/libnet_build_vrrp.c
libnet/src/libnet_checksum.c
libnet/src/libnet_cq.c
libnet/src/libnet_if_addr.c
libnet/src/libnet_init.c
libnet/src/libnet_internal.c
libnet/src/libnet_link_linux.c
libnet/src/libnet_pblock.c
libnet/src/libnet_port_list.c
libnet/src/libnet_resolve.c
libnet/src/libnet_version.c
libnet/src/libnet_write.c
Diffstat (limited to 'libnet/sample')
-rw-r--r-- | libnet/sample/.#icmp_unreach.c.1.2 | 190 | ||||
-rw-r--r-- | libnet/sample/Makefile.am | 3 | ||||
-rw-r--r-- | libnet/sample/Makefile.in | 833 | ||||
-rw-r--r-- | libnet/sample/arp.c | 17 | ||||
-rw-r--r-- | libnet/sample/bgp4_hdr.c | 3 | ||||
-rw-r--r-- | libnet/sample/cdp.c | 181 | ||||
-rw-r--r-- | libnet/sample/dhcp_discover.c | 162 | ||||
-rw-r--r-- | libnet/sample/get_addr.c | 4 | ||||
-rw-r--r-- | libnet/sample/hsrp.c | 196 | ||||
-rw-r--r-- | libnet/sample/icmp6_echoreq.c | 2 | ||||
-rw-r--r-- | libnet/sample/ospf_hello.c | 11 | ||||
-rw-r--r-- | libnet/sample/synflood6.c | 1 |
12 files changed, 1383 insertions, 220 deletions
diff --git a/libnet/sample/.#icmp_unreach.c.1.2 b/libnet/sample/.#icmp_unreach.c.1.2 new file mode 100644 index 0000000..0c155db --- /dev/null +++ b/libnet/sample/.#icmp_unreach.c.1.2 @@ -0,0 +1,190 @@ +/* + * $Id: icmp_unreach.c,v 1.2 2004/01/03 20:31:01 mike Exp $ + * + * libnet 1.1 + * Build an ICMP unreachable packet + * + * Hacked by Aaron Turner <aturner@pobox.com> to illustrate two bugs + * + * Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#if (HAVE_CONFIG_H) +#include "../include/config.h" +#endif +#include "./libnet_test.h" + +int +main(int argc, char **argv) +{ + int c, i; + libnet_t *l = NULL; + libnet_ptag_t icmp = 0, ip = 0, eth = 0; + u_long src_ip, dst_ip; + u_char payload[8] = {0x11, 0x11, 0x22, 0x22, 0x00, 0x08, 0xc6, 0xa5}; + u_long payload_s = 8; + int mode = LIBNET_LINK; + char errbuf[LIBNET_ERRBUF_SIZE]; + + printf("libnet 1.1 packet shaping: ICMP unreachable[link]\n"); + + src_ip = 0; + dst_ip = 0; + + while((c = getopt(argc, argv, "d:s:r")) != EOF) + { + switch (c) + { + case 'd': + if ((dst_ip = libnet_name2addr4(l, optarg, LIBNET_RESOLVE)) == -1) + { + fprintf(stderr, "Bad destination IP address: %s\n", optarg); + exit(1); + } + break; + case 's': + if ((src_ip = libnet_name2addr4(l, optarg, LIBNET_RESOLVE)) == -1) + { + fprintf(stderr, "Bad source IP address: %s\n", optarg); + exit(1); + } + break; + case 'r': + mode = LIBNET_RAW4; + break; + } + } + if (!src_ip || !dst_ip) + { + usage(argv[0]); + exit(EXIT_FAILURE); + } + + /* + * Initialize the library. Root priviledges are required. + */ + l = libnet_init( + mode, /* injection type */ + NULL, /* network interface */ + errbuf); /* errbuf */ + + if (l == NULL) + { + fprintf(stderr, "libnet_init() failed: %s", errbuf); + exit(EXIT_FAILURE); + } + +for (i = 1; i <= 255; i ++) { + icmp = libnet_build_icmpv4_unreach( + ICMP_UNREACH, /* type */ + ICMP_UNREACH_PORT, /* code */ + 0, /* checksum */ + LIBNET_IPV4_H + payload_s, /* o length */ + IPTOS_LOWDELAY | IPTOS_THROUGHPUT, /* o IP tos */ + (u_int16_t)i, /* o IP ID */ + 0, /* o frag */ + 64, /* o TTL */ + IPPROTO_UDP, /* o protocol */ + 0, /* o checksum */ + dst_ip, /* o source IP */ + src_ip, /* o destination IP */ + payload, /* payload */ + payload_s, /* payload size */ + l, /* libnet handle */ + icmp); + if (icmp == -1) + { + fprintf(stderr, "Can't build ICMP header: %s\n", libnet_geterror(l)); + goto bad; + } + + ip = libnet_build_ipv4( + LIBNET_IPV4_H + LIBNET_ICMPV4_UNREACH_H + + LIBNET_IPV4_H + payload_s, /* length */ + IPTOS_LOWDELAY | IPTOS_THROUGHPUT, /* TOS */ + (u_int16_t)i, /* IP ID */ + 0, /* IP Frag */ + 64, /* TTL */ + IPPROTO_ICMP, /* protocol */ + 0, /* checksum */ + src_ip, /* source IP */ + dst_ip, /* destination IP */ + NULL, /* payload */ + 0, /* payload size */ + l, /* libnet handle */ + ip); + if (ip == -1) + { + fprintf(stderr, "Can't build IP header: %s\n", libnet_geterror(l)); + goto bad; + } + + if (mode == LIBNET_LINK) { + eth = libnet_build_ethernet( + enet_dst, /* ethernet destination */ + enet_src, /* ethernet source */ + ETHERTYPE_IP, /* protocol type */ + NULL, /* payload */ + 0, /* payload size */ + l, /* libnet handle */ + eth); /* libnet id */ + + if (eth == -1) + { + fprintf(stderr, "Can't build ethernet header: %s\n", libnet_geterror(l)); + goto bad; + } + } + /* + * Write it to the wire. + */ + libnet_diag_dump_pblock(l); + c = libnet_write(l); + if (c == -1) + { + fprintf(stderr, "Write error: %s\n", libnet_geterror(l)); + goto bad; + } + else + { + fprintf(stderr, "Wrote %d byte ICMP packet; check the wire.\n", c); + } +} + libnet_destroy(l); + return (EXIT_SUCCESS); +bad: + libnet_destroy(l); + return (EXIT_FAILURE); +} + + +void +usage(char *name) +{ + fprintf(stderr, "usage: %s [-r] -s source_ip -d destination_ip\n ", name); +} + +/* EOF */ diff --git a/libnet/sample/Makefile.am b/libnet/sample/Makefile.am index 05cccbb..35e6540 100644 --- a/libnet/sample/Makefile.am +++ b/libnet/sample/Makefile.am @@ -14,7 +14,7 @@ noinst_PROGRAMS = arp cdp dhcp_discover get_addr icmp_timestamp icmp_unreach \ smurf dot1x dns rpc_tcp rpc_udp mpls icmp_timeexceed \ fddi_tcp1 fddi_tcp2 tring_tcp1 tring_tcp2 icmp_redirect \ bgp4_hdr bgp4_open bgp4_update bgp4_notification gre \ - synflood6_frag tftp ip_link ip_raw sebek + synflood6_frag tftp ip_link ip_raw sebek hsrp arp_SOURCES = arp.c cdp_SOURCES = cdp.c @@ -59,5 +59,6 @@ gre_SOURCES = gre.c ip_raw_SOURCES = ip_raw.c ip_link_SOURCES = ip_link.c sebek_SOURCES = sebek.c +hsrp_SOURCES = hsrp.c LDADD = $(top_srcdir)/src/libnet.la diff --git a/libnet/sample/Makefile.in b/libnet/sample/Makefile.in new file mode 100644 index 0000000..36573f0 --- /dev/null +++ b/libnet/sample/Makefile.in @@ -0,0 +1,833 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# $Id: Makefile.am,v 1.6 2004/11/09 07:05:07 mike Exp $ +# +# Libnet automake information file +# Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> +# All rights reserved. +# +# Process this file with automake to produce a Makefile.in script. + +# $Id: Makefile.am.common,v 1.3 2004/01/03 20:31:00 mike Exp $ +# +# Libnet automake information file +# Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> +# All rights reserved. +# + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/Makefile.am.common +noinst_PROGRAMS = arp$(EXEEXT) cdp$(EXEEXT) dhcp_discover$(EXEEXT) \ + get_addr$(EXEEXT) icmp_timestamp$(EXEEXT) \ + icmp_unreach$(EXEEXT) ieee$(EXEEXT) isl$(EXEEXT) ntp$(EXEEXT) \ + ospf_hello$(EXEEXT) ospf_lsa$(EXEEXT) ping_of_death$(EXEEXT) \ + stp$(EXEEXT) synflood$(EXEEXT) tcp1$(EXEEXT) tcp2$(EXEEXT) \ + udp1$(EXEEXT) udp2$(EXEEXT) synflood6$(EXEEXT) \ + icmp6_echoreq$(EXEEXT) icmp_echo_cq$(EXEEXT) smurf$(EXEEXT) \ + dot1x$(EXEEXT) dns$(EXEEXT) rpc_tcp$(EXEEXT) rpc_udp$(EXEEXT) \ + mpls$(EXEEXT) icmp_timeexceed$(EXEEXT) fddi_tcp1$(EXEEXT) \ + fddi_tcp2$(EXEEXT) tring_tcp1$(EXEEXT) tring_tcp2$(EXEEXT) \ + icmp_redirect$(EXEEXT) bgp4_hdr$(EXEEXT) bgp4_open$(EXEEXT) \ + bgp4_update$(EXEEXT) bgp4_notification$(EXEEXT) gre$(EXEEXT) \ + synflood6_frag$(EXEEXT) tftp$(EXEEXT) ip_link$(EXEEXT) \ + ip_raw$(EXEEXT) sebek$(EXEEXT) hsrp$(EXEEXT) +subdir = sample +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/include/config.h +CONFIG_CLEAN_FILES = +PROGRAMS = $(noinst_PROGRAMS) +am_arp_OBJECTS = arp.$(OBJEXT) +arp_OBJECTS = $(am_arp_OBJECTS) +arp_LDADD = $(LDADD) +arp_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_bgp4_hdr_OBJECTS = bgp4_hdr.$(OBJEXT) +bgp4_hdr_OBJECTS = $(am_bgp4_hdr_OBJECTS) +bgp4_hdr_LDADD = $(LDADD) +bgp4_hdr_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_bgp4_notification_OBJECTS = bgp4_notification.$(OBJEXT) +bgp4_notification_OBJECTS = $(am_bgp4_notification_OBJECTS) +bgp4_notification_LDADD = $(LDADD) +bgp4_notification_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_bgp4_open_OBJECTS = bgp4_open.$(OBJEXT) +bgp4_open_OBJECTS = $(am_bgp4_open_OBJECTS) +bgp4_open_LDADD = $(LDADD) +bgp4_open_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_bgp4_update_OBJECTS = bgp4_update.$(OBJEXT) +bgp4_update_OBJECTS = $(am_bgp4_update_OBJECTS) +bgp4_update_LDADD = $(LDADD) +bgp4_update_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_cdp_OBJECTS = cdp.$(OBJEXT) +cdp_OBJECTS = $(am_cdp_OBJECTS) +cdp_LDADD = $(LDADD) +cdp_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_dhcp_discover_OBJECTS = dhcp_discover.$(OBJEXT) +dhcp_discover_OBJECTS = $(am_dhcp_discover_OBJECTS) +dhcp_discover_LDADD = $(LDADD) +dhcp_discover_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_dns_OBJECTS = dns.$(OBJEXT) +dns_OBJECTS = $(am_dns_OBJECTS) +dns_LDADD = $(LDADD) +dns_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_dot1x_OBJECTS = dot1x.$(OBJEXT) +dot1x_OBJECTS = $(am_dot1x_OBJECTS) +dot1x_LDADD = $(LDADD) +dot1x_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_fddi_tcp1_OBJECTS = fddi_tcp1.$(OBJEXT) +fddi_tcp1_OBJECTS = $(am_fddi_tcp1_OBJECTS) +fddi_tcp1_LDADD = $(LDADD) +fddi_tcp1_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_fddi_tcp2_OBJECTS = fddi_tcp2.$(OBJEXT) +fddi_tcp2_OBJECTS = $(am_fddi_tcp2_OBJECTS) +fddi_tcp2_LDADD = $(LDADD) +fddi_tcp2_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_get_addr_OBJECTS = get_addr.$(OBJEXT) +get_addr_OBJECTS = $(am_get_addr_OBJECTS) +get_addr_LDADD = $(LDADD) +get_addr_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_gre_OBJECTS = gre.$(OBJEXT) +gre_OBJECTS = $(am_gre_OBJECTS) +gre_LDADD = $(LDADD) +gre_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_hsrp_OBJECTS = hsrp.$(OBJEXT) +hsrp_OBJECTS = $(am_hsrp_OBJECTS) +hsrp_LDADD = $(LDADD) +hsrp_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_icmp6_echoreq_OBJECTS = icmp6_echoreq.$(OBJEXT) +icmp6_echoreq_OBJECTS = $(am_icmp6_echoreq_OBJECTS) +icmp6_echoreq_LDADD = $(LDADD) +icmp6_echoreq_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_icmp_echo_cq_OBJECTS = icmp_echo_cq.$(OBJEXT) +icmp_echo_cq_OBJECTS = $(am_icmp_echo_cq_OBJECTS) +icmp_echo_cq_LDADD = $(LDADD) +icmp_echo_cq_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_icmp_redirect_OBJECTS = icmp_redirect.$(OBJEXT) +icmp_redirect_OBJECTS = $(am_icmp_redirect_OBJECTS) +icmp_redirect_LDADD = $(LDADD) +icmp_redirect_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_icmp_timeexceed_OBJECTS = icmp_timeexceed.$(OBJEXT) +icmp_timeexceed_OBJECTS = $(am_icmp_timeexceed_OBJECTS) +icmp_timeexceed_LDADD = $(LDADD) +icmp_timeexceed_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_icmp_timestamp_OBJECTS = icmp_timestamp.$(OBJEXT) +icmp_timestamp_OBJECTS = $(am_icmp_timestamp_OBJECTS) +icmp_timestamp_LDADD = $(LDADD) +icmp_timestamp_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_icmp_unreach_OBJECTS = icmp_unreach.$(OBJEXT) +icmp_unreach_OBJECTS = $(am_icmp_unreach_OBJECTS) +icmp_unreach_LDADD = $(LDADD) +icmp_unreach_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_ieee_OBJECTS = ieee.$(OBJEXT) +ieee_OBJECTS = $(am_ieee_OBJECTS) +ieee_LDADD = $(LDADD) +ieee_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_ip_link_OBJECTS = ip_link.$(OBJEXT) +ip_link_OBJECTS = $(am_ip_link_OBJECTS) +ip_link_LDADD = $(LDADD) +ip_link_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_ip_raw_OBJECTS = ip_raw.$(OBJEXT) +ip_raw_OBJECTS = $(am_ip_raw_OBJECTS) +ip_raw_LDADD = $(LDADD) +ip_raw_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_isl_OBJECTS = isl.$(OBJEXT) +isl_OBJECTS = $(am_isl_OBJECTS) +isl_LDADD = $(LDADD) +isl_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_mpls_OBJECTS = mpls.$(OBJEXT) +mpls_OBJECTS = $(am_mpls_OBJECTS) +mpls_LDADD = $(LDADD) +mpls_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_ntp_OBJECTS = ntp.$(OBJEXT) +ntp_OBJECTS = $(am_ntp_OBJECTS) +ntp_LDADD = $(LDADD) +ntp_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_ospf_hello_OBJECTS = ospf_hello.$(OBJEXT) +ospf_hello_OBJECTS = $(am_ospf_hello_OBJECTS) +ospf_hello_LDADD = $(LDADD) +ospf_hello_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_ospf_lsa_OBJECTS = ospf_lsa.$(OBJEXT) +ospf_lsa_OBJECTS = $(am_ospf_lsa_OBJECTS) +ospf_lsa_LDADD = $(LDADD) +ospf_lsa_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_ping_of_death_OBJECTS = ping_of_death.$(OBJEXT) +ping_of_death_OBJECTS = $(am_ping_of_death_OBJECTS) +ping_of_death_LDADD = $(LDADD) +ping_of_death_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_rpc_tcp_OBJECTS = rpc_tcp.$(OBJEXT) +rpc_tcp_OBJECTS = $(am_rpc_tcp_OBJECTS) +rpc_tcp_LDADD = $(LDADD) +rpc_tcp_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_rpc_udp_OBJECTS = rpc_udp.$(OBJEXT) +rpc_udp_OBJECTS = $(am_rpc_udp_OBJECTS) +rpc_udp_LDADD = $(LDADD) +rpc_udp_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_sebek_OBJECTS = sebek.$(OBJEXT) +sebek_OBJECTS = $(am_sebek_OBJECTS) +sebek_LDADD = $(LDADD) +sebek_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_smurf_OBJECTS = smurf.$(OBJEXT) +smurf_OBJECTS = $(am_smurf_OBJECTS) +smurf_LDADD = $(LDADD) +smurf_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_stp_OBJECTS = stp.$(OBJEXT) +stp_OBJECTS = $(am_stp_OBJECTS) +stp_LDADD = $(LDADD) +stp_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_synflood_OBJECTS = synflood.$(OBJEXT) +synflood_OBJECTS = $(am_synflood_OBJECTS) +synflood_LDADD = $(LDADD) +synflood_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_synflood6_OBJECTS = synflood6.$(OBJEXT) +synflood6_OBJECTS = $(am_synflood6_OBJECTS) +synflood6_LDADD = $(LDADD) +synflood6_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_synflood6_frag_OBJECTS = synflood6_frag.$(OBJEXT) +synflood6_frag_OBJECTS = $(am_synflood6_frag_OBJECTS) +synflood6_frag_LDADD = $(LDADD) +synflood6_frag_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_tcp1_OBJECTS = tcp1.$(OBJEXT) +tcp1_OBJECTS = $(am_tcp1_OBJECTS) +tcp1_LDADD = $(LDADD) +tcp1_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_tcp2_OBJECTS = tcp2.$(OBJEXT) +tcp2_OBJECTS = $(am_tcp2_OBJECTS) +tcp2_LDADD = $(LDADD) +tcp2_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_tftp_OBJECTS = tftp.$(OBJEXT) +tftp_OBJECTS = $(am_tftp_OBJECTS) +tftp_LDADD = $(LDADD) +tftp_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_tring_tcp1_OBJECTS = tring_tcp1.$(OBJEXT) +tring_tcp1_OBJECTS = $(am_tring_tcp1_OBJECTS) +tring_tcp1_LDADD = $(LDADD) +tring_tcp1_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_tring_tcp2_OBJECTS = tring_tcp2.$(OBJEXT) +tring_tcp2_OBJECTS = $(am_tring_tcp2_OBJECTS) +tring_tcp2_LDADD = $(LDADD) +tring_tcp2_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_udp1_OBJECTS = udp1.$(OBJEXT) +udp1_OBJECTS = $(am_udp1_OBJECTS) +udp1_LDADD = $(LDADD) +udp1_DEPENDENCIES = $(top_srcdir)/src/libnet.la +am_udp2_OBJECTS = udp2.$(OBJEXT) +udp2_OBJECTS = $(am_udp2_OBJECTS) +udp2_LDADD = $(LDADD) +udp2_DEPENDENCIES = $(top_srcdir)/src/libnet.la +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include +depcomp = +am__depfiles_maybe = +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(arp_SOURCES) $(bgp4_hdr_SOURCES) \ + $(bgp4_notification_SOURCES) $(bgp4_open_SOURCES) \ + $(bgp4_update_SOURCES) $(cdp_SOURCES) $(dhcp_discover_SOURCES) \ + $(dns_SOURCES) $(dot1x_SOURCES) $(fddi_tcp1_SOURCES) \ + $(fddi_tcp2_SOURCES) $(get_addr_SOURCES) $(gre_SOURCES) \ + $(hsrp_SOURCES) $(icmp6_echoreq_SOURCES) \ + $(icmp_echo_cq_SOURCES) $(icmp_redirect_SOURCES) \ + $(icmp_timeexceed_SOURCES) $(icmp_timestamp_SOURCES) \ + $(icmp_unreach_SOURCES) $(ieee_SOURCES) $(ip_link_SOURCES) \ + $(ip_raw_SOURCES) $(isl_SOURCES) $(mpls_SOURCES) \ + $(ntp_SOURCES) $(ospf_hello_SOURCES) $(ospf_lsa_SOURCES) \ + $(ping_of_death_SOURCES) $(rpc_tcp_SOURCES) $(rpc_udp_SOURCES) \ + $(sebek_SOURCES) $(smurf_SOURCES) $(stp_SOURCES) \ + $(synflood_SOURCES) $(synflood6_SOURCES) \ + $(synflood6_frag_SOURCES) $(tcp1_SOURCES) $(tcp2_SOURCES) \ + $(tftp_SOURCES) $(tring_tcp1_SOURCES) $(tring_tcp2_SOURCES) \ + $(udp1_SOURCES) $(udp2_SOURCES) +DIST_SOURCES = $(arp_SOURCES) $(bgp4_hdr_SOURCES) \ + $(bgp4_notification_SOURCES) $(bgp4_open_SOURCES) \ + $(bgp4_update_SOURCES) $(cdp_SOURCES) $(dhcp_discover_SOURCES) \ + $(dns_SOURCES) $(dot1x_SOURCES) $(fddi_tcp1_SOURCES) \ + $(fddi_tcp2_SOURCES) $(get_addr_SOURCES) $(gre_SOURCES) \ + $(hsrp_SOURCES) $(icmp6_echoreq_SOURCES) \ + $(icmp_echo_cq_SOURCES) $(icmp_redirect_SOURCES) \ + $(icmp_timeexceed_SOURCES) $(icmp_timestamp_SOURCES) \ + $(icmp_unreach_SOURCES) $(ieee_SOURCES) $(ip_link_SOURCES) \ + $(ip_raw_SOURCES) $(isl_SOURCES) $(mpls_SOURCES) \ + $(ntp_SOURCES) $(ospf_hello_SOURCES) $(ospf_lsa_SOURCES) \ + $(ping_of_death_SOURCES) $(rpc_tcp_SOURCES) $(rpc_udp_SOURCES) \ + $(sebek_SOURCES) $(smurf_SOURCES) $(stp_SOURCES) \ + $(synflood_SOURCES) $(synflood6_SOURCES) \ + $(synflood6_frag_SOURCES) $(tcp1_SOURCES) $(tcp2_SOURCES) \ + $(tftp_SOURCES) $(tring_tcp1_SOURCES) $(tring_tcp2_SOURCES) \ + $(udp1_SOURCES) $(udp2_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ADDITIONAL_LIBS = @ADDITIONAL_LIBS@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENDIANESS = @ENDIANESS@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ +HAVE_PACKET_SOCKET = @HAVE_PACKET_SOCKET@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBNET_CONFIG_CFLAGS = @LIBNET_CONFIG_CFLAGS@ +LIBNET_CONFIG_DEFINES = @LIBNET_CONFIG_DEFINES@ +LIBNET_CONFIG_LIBS = @LIBNET_CONFIG_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +AUTOMAKE_OPTIONS = foreign no-dependencies +DISTCLEANFILES = *~ +arp_SOURCES = arp.c +cdp_SOURCES = cdp.c +dot1x_SOURCES = dot1x.c +dhcp_discover_SOURCES = dhcp_discover.c +dns_SOURCES = dns.c +fddi_tcp1_SOURCES = fddi_tcp1.c +fddi_tcp2_SOURCES = fddi_tcp2.c +tring_tcp1_SOURCES = tring_tcp1.c +tring_tcp2_SOURCES = tring_tcp2.c +get_addr_SOURCES = get_addr.c +icmp_echo_cq_SOURCES = icmp_echo_cq.c +icmp_redirect_SOURCES = icmp_redirect.c +icmp_timestamp_SOURCES = icmp_timestamp.c +icmp_timeexceed_SOURCES = icmp_timeexceed.c +icmp_unreach_SOURCES = icmp_unreach.c +ieee_SOURCES = ieee.c +isl_SOURCES = isl.c +ntp_SOURCES = ntp.c +ospf_hello_SOURCES = ospf_hello.c +ospf_lsa_SOURCES = ospf_lsa.c +ping_of_death_SOURCES = ping_of_death.c +mpls_SOURCES = mpls.c +rpc_tcp_SOURCES = rpc_tcp.c +rpc_udp_SOURCES = rpc_udp.c +stp_SOURCES = stp.c +synflood_SOURCES = synflood.c +tcp1_SOURCES = tcp1.c +tcp2_SOURCES = tcp2.c +tftp_SOURCES = tftp.c +udp1_SOURCES = udp1.c +udp2_SOURCES = udp2.c +icmp6_echoreq_SOURCES = icmp6_echoreq.c +smurf_SOURCES = smurf.c +synflood6_SOURCES = synflood6.c +synflood6_frag_SOURCES = synflood6_frag.c +bgp4_hdr_SOURCES = bgp4_hdr.c +bgp4_open_SOURCES = bgp4_open.c +bgp4_update_SOURCES = bgp4_update.c +bgp4_notification_SOURCES = bgp4_notification.c +gre_SOURCES = gre.c +ip_raw_SOURCES = ip_raw.c +ip_link_SOURCES = ip_link.c +sebek_SOURCES = sebek.c +hsrp_SOURCES = hsrp.c +LDADD = $(top_srcdir)/src/libnet.la +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.common $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign sample/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign sample/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +arp$(EXEEXT): $(arp_OBJECTS) $(arp_DEPENDENCIES) + @rm -f arp$(EXEEXT) + $(LINK) $(arp_LDFLAGS) $(arp_OBJECTS) $(arp_LDADD) $(LIBS) +bgp4_hdr$(EXEEXT): $(bgp4_hdr_OBJECTS) $(bgp4_hdr_DEPENDENCIES) + @rm -f bgp4_hdr$(EXEEXT) + $(LINK) $(bgp4_hdr_LDFLAGS) $(bgp4_hdr_OBJECTS) $(bgp4_hdr_LDADD) $(LIBS) +bgp4_notification$(EXEEXT): $(bgp4_notification_OBJECTS) $(bgp4_notification_DEPENDENCIES) + @rm -f bgp4_notification$(EXEEXT) + $(LINK) $(bgp4_notification_LDFLAGS) $(bgp4_notification_OBJECTS) $(bgp4_notification_LDADD) $(LIBS) +bgp4_open$(EXEEXT): $(bgp4_open_OBJECTS) $(bgp4_open_DEPENDENCIES) + @rm -f bgp4_open$(EXEEXT) + $(LINK) $(bgp4_open_LDFLAGS) $(bgp4_open_OBJECTS) $(bgp4_open_LDADD) $(LIBS) +bgp4_update$(EXEEXT): $(bgp4_update_OBJECTS) $(bgp4_update_DEPENDENCIES) + @rm -f bgp4_update$(EXEEXT) + $(LINK) $(bgp4_update_LDFLAGS) $(bgp4_update_OBJECTS) $(bgp4_update_LDADD) $(LIBS) +cdp$(EXEEXT): $(cdp_OBJECTS) $(cdp_DEPENDENCIES) + @rm -f cdp$(EXEEXT) + $(LINK) $(cdp_LDFLAGS) $(cdp_OBJECTS) $(cdp_LDADD) $(LIBS) +dhcp_discover$(EXEEXT): $(dhcp_discover_OBJECTS) $(dhcp_discover_DEPENDENCIES) + @rm -f dhcp_discover$(EXEEXT) + $(LINK) $(dhcp_discover_LDFLAGS) $(dhcp_discover_OBJECTS) $(dhcp_discover_LDADD) $(LIBS) +dns$(EXEEXT): $(dns_OBJECTS) $(dns_DEPENDENCIES) + @rm -f dns$(EXEEXT) + $(LINK) $(dns_LDFLAGS) $(dns_OBJECTS) $(dns_LDADD) $(LIBS) +dot1x$(EXEEXT): $(dot1x_OBJECTS) $(dot1x_DEPENDENCIES) + @rm -f dot1x$(EXEEXT) + $(LINK) $(dot1x_LDFLAGS) $(dot1x_OBJECTS) $(dot1x_LDADD) $(LIBS) +fddi_tcp1$(EXEEXT): $(fddi_tcp1_OBJECTS) $(fddi_tcp1_DEPENDENCIES) + @rm -f fddi_tcp1$(EXEEXT) + $(LINK) $(fddi_tcp1_LDFLAGS) $(fddi_tcp1_OBJECTS) $(fddi_tcp1_LDADD) $(LIBS) +fddi_tcp2$(EXEEXT): $(fddi_tcp2_OBJECTS) $(fddi_tcp2_DEPENDENCIES) + @rm -f fddi_tcp2$(EXEEXT) + $(LINK) $(fddi_tcp2_LDFLAGS) $(fddi_tcp2_OBJECTS) $(fddi_tcp2_LDADD) $(LIBS) +get_addr$(EXEEXT): $(get_addr_OBJECTS) $(get_addr_DEPENDENCIES) + @rm -f get_addr$(EXEEXT) + $(LINK) $(get_addr_LDFLAGS) $(get_addr_OBJECTS) $(get_addr_LDADD) $(LIBS) +gre$(EXEEXT): $(gre_OBJECTS) $(gre_DEPENDENCIES) + @rm -f gre$(EXEEXT) + $(LINK) $(gre_LDFLAGS) $(gre_OBJECTS) $(gre_LDADD) $(LIBS) +hsrp$(EXEEXT): $(hsrp_OBJECTS) $(hsrp_DEPENDENCIES) + @rm -f hsrp$(EXEEXT) + $(LINK) $(hsrp_LDFLAGS) $(hsrp_OBJECTS) $(hsrp_LDADD) $(LIBS) +icmp6_echoreq$(EXEEXT): $(icmp6_echoreq_OBJECTS) $(icmp6_echoreq_DEPENDENCIES) + @rm -f icmp6_echoreq$(EXEEXT) + $(LINK) $(icmp6_echoreq_LDFLAGS) $(icmp6_echoreq_OBJECTS) $(icmp6_echoreq_LDADD) $(LIBS) +icmp_echo_cq$(EXEEXT): $(icmp_echo_cq_OBJECTS) $(icmp_echo_cq_DEPENDENCIES) + @rm -f icmp_echo_cq$(EXEEXT) + $(LINK) $(icmp_echo_cq_LDFLAGS) $(icmp_echo_cq_OBJECTS) $(icmp_echo_cq_LDADD) $(LIBS) +icmp_redirect$(EXEEXT): $(icmp_redirect_OBJECTS) $(icmp_redirect_DEPENDENCIES) + @rm -f icmp_redirect$(EXEEXT) + $(LINK) $(icmp_redirect_LDFLAGS) $(icmp_redirect_OBJECTS) $(icmp_redirect_LDADD) $(LIBS) +icmp_timeexceed$(EXEEXT): $(icmp_timeexceed_OBJECTS) $(icmp_timeexceed_DEPENDENCIES) + @rm -f icmp_timeexceed$(EXEEXT) + $(LINK) $(icmp_timeexceed_LDFLAGS) $(icmp_timeexceed_OBJECTS) $(icmp_timeexceed_LDADD) $(LIBS) +icmp_timestamp$(EXEEXT): $(icmp_timestamp_OBJECTS) $(icmp_timestamp_DEPENDENCIES) + @rm -f icmp_timestamp$(EXEEXT) + $(LINK) $(icmp_timestamp_LDFLAGS) $(icmp_timestamp_OBJECTS) $(icmp_timestamp_LDADD) $(LIBS) +icmp_unreach$(EXEEXT): $(icmp_unreach_OBJECTS) $(icmp_unreach_DEPENDENCIES) + @rm -f icmp_unreach$(EXEEXT) + $(LINK) $(icmp_unreach_LDFLAGS) $(icmp_unreach_OBJECTS) $(icmp_unreach_LDADD) $(LIBS) +ieee$(EXEEXT): $(ieee_OBJECTS) $(ieee_DEPENDENCIES) + @rm -f ieee$(EXEEXT) + $(LINK) $(ieee_LDFLAGS) $(ieee_OBJECTS) $(ieee_LDADD) $(LIBS) +ip_link$(EXEEXT): $(ip_link_OBJECTS) $(ip_link_DEPENDENCIES) + @rm -f ip_link$(EXEEXT) + $(LINK) $(ip_link_LDFLAGS) $(ip_link_OBJECTS) $(ip_link_LDADD) $(LIBS) +ip_raw$(EXEEXT): $(ip_raw_OBJECTS) $(ip_raw_DEPENDENCIES) + @rm -f ip_raw$(EXEEXT) + $(LINK) $(ip_raw_LDFLAGS) $(ip_raw_OBJECTS) $(ip_raw_LDADD) $(LIBS) +isl$(EXEEXT): $(isl_OBJECTS) $(isl_DEPENDENCIES) + @rm -f isl$(EXEEXT) + $(LINK) $(isl_LDFLAGS) $(isl_OBJECTS) $(isl_LDADD) $(LIBS) +mpls$(EXEEXT): $(mpls_OBJECTS) $(mpls_DEPENDENCIES) + @rm -f mpls$(EXEEXT) + $(LINK) $(mpls_LDFLAGS) $(mpls_OBJECTS) $(mpls_LDADD) $(LIBS) +ntp$(EXEEXT): $(ntp_OBJECTS) $(ntp_DEPENDENCIES) + @rm -f ntp$(EXEEXT) + $(LINK) $(ntp_LDFLAGS) $(ntp_OBJECTS) $(ntp_LDADD) $(LIBS) +ospf_hello$(EXEEXT): $(ospf_hello_OBJECTS) $(ospf_hello_DEPENDENCIES) + @rm -f ospf_hello$(EXEEXT) + $(LINK) $(ospf_hello_LDFLAGS) $(ospf_hello_OBJECTS) $(ospf_hello_LDADD) $(LIBS) +ospf_lsa$(EXEEXT): $(ospf_lsa_OBJECTS) $(ospf_lsa_DEPENDENCIES) + @rm -f ospf_lsa$(EXEEXT) + $(LINK) $(ospf_lsa_LDFLAGS) $(ospf_lsa_OBJECTS) $(ospf_lsa_LDADD) $(LIBS) +ping_of_death$(EXEEXT): $(ping_of_death_OBJECTS) $(ping_of_death_DEPENDENCIES) + @rm -f ping_of_death$(EXEEXT) + $(LINK) $(ping_of_death_LDFLAGS) $(ping_of_death_OBJECTS) $(ping_of_death_LDADD) $(LIBS) +rpc_tcp$(EXEEXT): $(rpc_tcp_OBJECTS) $(rpc_tcp_DEPENDENCIES) + @rm -f rpc_tcp$(EXEEXT) + $(LINK) $(rpc_tcp_LDFLAGS) $(rpc_tcp_OBJECTS) $(rpc_tcp_LDADD) $(LIBS) +rpc_udp$(EXEEXT): $(rpc_udp_OBJECTS) $(rpc_udp_DEPENDENCIES) + @rm -f rpc_udp$(EXEEXT) + $(LINK) $(rpc_udp_LDFLAGS) $(rpc_udp_OBJECTS) $(rpc_udp_LDADD) $(LIBS) +sebek$(EXEEXT): $(sebek_OBJECTS) $(sebek_DEPENDENCIES) + @rm -f sebek$(EXEEXT) + $(LINK) $(sebek_LDFLAGS) $(sebek_OBJECTS) $(sebek_LDADD) $(LIBS) +smurf$(EXEEXT): $(smurf_OBJECTS) $(smurf_DEPENDENCIES) + @rm -f smurf$(EXEEXT) + $(LINK) $(smurf_LDFLAGS) $(smurf_OBJECTS) $(smurf_LDADD) $(LIBS) +stp$(EXEEXT): $(stp_OBJECTS) $(stp_DEPENDENCIES) + @rm -f stp$(EXEEXT) + $(LINK) $(stp_LDFLAGS) $(stp_OBJECTS) $(stp_LDADD) $(LIBS) +synflood$(EXEEXT): $(synflood_OBJECTS) $(synflood_DEPENDENCIES) + @rm -f synflood$(EXEEXT) + $(LINK) $(synflood_LDFLAGS) $(synflood_OBJECTS) $(synflood_LDADD) $(LIBS) +synflood6$(EXEEXT): $(synflood6_OBJECTS) $(synflood6_DEPENDENCIES) + @rm -f synflood6$(EXEEXT) + $(LINK) $(synflood6_LDFLAGS) $(synflood6_OBJECTS) $(synflood6_LDADD) $(LIBS) +synflood6_frag$(EXEEXT): $(synflood6_frag_OBJECTS) $(synflood6_frag_DEPENDENCIES) + @rm -f synflood6_frag$(EXEEXT) + $(LINK) $(synflood6_frag_LDFLAGS) $(synflood6_frag_OBJECTS) $(synflood6_frag_LDADD) $(LIBS) +tcp1$(EXEEXT): $(tcp1_OBJECTS) $(tcp1_DEPENDENCIES) + @rm -f tcp1$(EXEEXT) + $(LINK) $(tcp1_LDFLAGS) $(tcp1_OBJECTS) $(tcp1_LDADD) $(LIBS) +tcp2$(EXEEXT): $(tcp2_OBJECTS) $(tcp2_DEPENDENCIES) + @rm -f tcp2$(EXEEXT) + $(LINK) $(tcp2_LDFLAGS) $(tcp2_OBJECTS) $(tcp2_LDADD) $(LIBS) +tftp$(EXEEXT): $(tftp_OBJECTS) $(tftp_DEPENDENCIES) + @rm -f tftp$(EXEEXT) + $(LINK) $(tftp_LDFLAGS) $(tftp_OBJECTS) $(tftp_LDADD) $(LIBS) +tring_tcp1$(EXEEXT): $(tring_tcp1_OBJECTS) $(tring_tcp1_DEPENDENCIES) + @rm -f tring_tcp1$(EXEEXT) + $(LINK) $(tring_tcp1_LDFLAGS) $(tring_tcp1_OBJECTS) $(tring_tcp1_LDADD) $(LIBS) +tring_tcp2$(EXEEXT): $(tring_tcp2_OBJECTS) $(tring_tcp2_DEPENDENCIES) + @rm -f tring_tcp2$(EXEEXT) + $(LINK) $(tring_tcp2_LDFLAGS) $(tring_tcp2_OBJECTS) $(tring_tcp2_LDADD) $(LIBS) +udp1$(EXEEXT): $(udp1_OBJECTS) $(udp1_DEPENDENCIES) + @rm -f udp1$(EXEEXT) + $(LINK) $(udp1_LDFLAGS) $(udp1_OBJECTS) $(udp1_LDADD) $(LIBS) +udp2$(EXEEXT): $(udp2_OBJECTS) $(udp2_DEPENDENCIES) + @rm -f udp2$(EXEEXT) + $(LINK) $(udp2_LDFLAGS) $(udp2_OBJECTS) $(udp2_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +.c.o: + $(COMPILE) -c $< + +.c.obj: + $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: + $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(mkdir_p) $(distdir)/.. + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libnet/sample/arp.c b/libnet/sample/arp.c index 428b48d..f1c95b9 100644 --- a/libnet/sample/arp.c +++ b/libnet/sample/arp.c @@ -1,5 +1,5 @@ /* - * $Id: arp.c,v 1.6 2004/03/01 20:26:12 mike Exp $ + * $Id: arp.c,v 1.7 2004/11/09 07:05:07 mike Exp $ * * libnet 1.1 * Build an ARP packet @@ -70,21 +70,6 @@ main(int argc, char *argv[]) } else - /* - * Build the packet, remmebering that order IS important. We must - * build the packet from lowest protocol type on up as it would - * appear on the wire. So for our ARP packet: - * - * ------------------------------------------- - * | Ethernet | ARP | - * ------------------------------------------- - * ^ ^ - * |------------------ | - * libnet_build_ethernet()--| | - * | - * libnet_build_arp()-----------| - */ - i = libnet_get_ipaddr4(l); t = libnet_build_arp( diff --git a/libnet/sample/bgp4_hdr.c b/libnet/sample/bgp4_hdr.c index d81802e..707709e 100644 --- a/libnet/sample/bgp4_hdr.c +++ b/libnet/sample/bgp4_hdr.c @@ -65,9 +65,6 @@ main(int argc, char *argv[]) printf("libnet 1.1 packet shaping: BGP4 hdr + payload[raw]\n"); - /* - * Initialize the library. Root priviledges are required. - */ l = libnet_init( LIBNET_RAW4, /* injection type */ NULL, /* network interface */ diff --git a/libnet/sample/cdp.c b/libnet/sample/cdp.c index 0f3896d..d96c950 100644 --- a/libnet/sample/cdp.c +++ b/libnet/sample/cdp.c @@ -1,10 +1,14 @@ /* - * $Id: cdp.c,v 1.2 2004/01/03 20:31:01 mike Exp $ + * $Id: cdp.c,v 1.3 2004/11/09 07:05:07 mike Exp $ * - * libnet 1.1 - * Build an CDP packet + * cdppoke + * CDP information injection tool + * Released as part of the MXFP Layer 2 Toolkit + * http://www.packetfactory.net/MXFP + * + * Copyright (c) 2004 Mike D. Schiffman <mike@infonexus.com> + * Copyright (c) 2004 Jeremy Rauch <jrauch@cadre.org> * - * Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,143 +35,112 @@ */ #if (HAVE_CONFIG_H) +#if ((_WIN32) && !(__CYGWIN__)) +#include "../include/win32/config.h" +#else #include "../include/config.h" #endif +#endif #include "./libnet_test.h" + int main(int argc, char *argv[]) { - int c, len; + int c, len, index; libnet_t *l; libnet_ptag_t t; - char *value; + u_char *value; u_char values[100]; u_short tmp; - u_long tmp2; - char *device = NULL; char errbuf[LIBNET_ERRBUF_SIZE]; + u_int8_t oui[3] = { 0x00, 0x00, 0x0c }; + u_int8_t cdp_mac[6] = {0x01, 0x0, 0xc, 0xcc, 0xcc, 0xcc}; - printf("libnet 1.1 packet shaping: CDP[link]\n"); - /* - * Initialize the library. Root priviledges are required. - */ - l = libnet_init( - LIBNET_LINK, /* injection type */ - device, /* network interface */ - errbuf); /* errbuf */ - - if (l == NULL) + if (argc != 3) { - fprintf(stderr, "libnet_init() failed: %s", errbuf); - exit(EXIT_FAILURE); + fprintf(stderr, "usage %s device device-id\n", argv[0]); + return (EXIT_FAILURE); } - value = "switch"; - len = strlen(value); + fprintf(stderr, "cdppoke...\n"); - t = libnet_build_cdp( - 1, /* version */ - 30, /* time to live */ - 0, /* checksum */ - LIBNET_CDP_DEVID, /* type */ - len, /* length */ - (u_char*)value, /* value */ - NULL, /* payload */ - 0, /* payload size */ - l, /* libnet handle */ - 0); /* libnet id */ - if (t == -1) + l = libnet_init(LIBNET_LINK, argv[1], errbuf); + if (l == NULL) { - fprintf(stderr, "Can't build CDP header: %s\n", libnet_geterror(l)); - goto bad; + fprintf(stderr, "libnet_init() failed: %s", errbuf); + return (EXIT_FAILURE); } + /* build the TLV's by hand until we get something better */ memset(values, 0, sizeof(values)); - tmp = htons(LIBNET_CDP_PORTID); - memcpy(values, &tmp, 2); - tmp = htons(0x0014); - memcpy(values + 2, &tmp, 2); - memcpy(values + 4, (u_char *)"FastEthernet0/20", 16); - t = libnet_build_data( - values, - 20, - l, - 0); - if (t == -1) - { - fprintf(stderr, "Can't build CDP data: %s\n", libnet_geterror(l)); - goto bad; - } - memset(values, 0, sizeof(values)); - tmp = htons(LIBNET_CDP_CAPABIL); - memcpy(values, &tmp, 2); - tmp = htons(0x0008); - memcpy(values + 2, &tmp, 2); - tmp2 = htonl((LIBNET_CDP_CAP_L2S | LIBNET_CDP_CAP_L2B)); - memcpy(values + 4, &tmp2, 4); - t = libnet_build_data( - values, - 8, - l, - 0); - if (t == -1) - { - fprintf(stderr, "Can't build CDP data: %s\n", libnet_geterror(l)); - goto bad; - } - memset(values, 0, sizeof(values)); + index = 0; + tmp = htons(LIBNET_CDP_VERSION); memcpy(values, &tmp, 2); - tmp = htons(0x001f); - memcpy(values + 2, &tmp, 2); - memcpy(values + 4, (u_char *)"ABCDEFGHIJKLMNOPQRSTUVWXYZ", 26); - t = libnet_build_data( - values, - 31, - l, - 0); + index += 2; + tmp = htons(9); /* length of string below plus type and length fields */ + memcpy(values + index, &tmp, 2); + index += 2; + memcpy(values + index, (u_char *)"1.1.1", 5); + index += 5; + + /* this TLV is handled by the libnet builder */ + value = argv[2]; + len = strlen(argv[2]); + + /* build CDP header */ + t = libnet_build_cdp( + 1, /* version */ + 30, /* time to live */ + 0x0, /* checksum */ + 0x1, /* type */ + len, /* length */ + value, /* value */ + values, /* payload */ + index, /* payload size */ + l, /* libnet context */ + 0); /* libnet ptag */ if (t == -1) { - fprintf(stderr, "Can't build CDP data: %s\n", libnet_geterror(l)); + fprintf(stderr, "Can't build CDP header: %s\n", libnet_geterror(l)); goto bad; } - memset(values, 0, sizeof(values)); - tmp = htons(LIBNET_CDP_PLATFORM); - memcpy(values, &tmp, 2); - tmp = htons(0x0015); - memcpy(values + 2, &tmp, 2); - memcpy(values + 4, (u_char *)"cisco WS-C2924-XL", 17); - t = libnet_build_data( - values, - 21, - l, - 0); + + /* build 802.2 header */ + t = libnet_build_802_2snap( + LIBNET_SAP_SNAP, /* SAP SNAP code */ + LIBNET_SAP_SNAP, /* SAP SNAP code */ + 0x03, /* control */ + oui, /* OUI */ + 0x2000, /* upper layer protocol type */ + NULL, /* payload */ + 0, /* payload size */ + l, /* libnet context */ + 0); /* libnet ptag */ if (t == -1) { - fprintf(stderr, "Can't build CDP data: %s\n", libnet_geterror(l)); + fprintf(stderr, "Can't build SNAP header: %s\n", libnet_geterror(l)); goto bad; } - t = libnet_build_ethernet( - enet_dst, /* ethernet destination */ - enet_src, /* ethernet source */ - 0x2000, /* protocol type */ - NULL, /* payload */ - 0, /* payload size */ - l, /* libnet handle */ - 0); /* libnet id */ + /* build 802.3 header */ + t = libnet_build_802_3( + cdp_mac, /* ethernet destination */ + (u_int8_t *)libnet_get_hwaddr(l), /* ethernet source */ + LIBNET_802_2_H + LIBNET_802_2SNAP_H + LIBNET_CDP_H, /* packet len */ + NULL, /* payload */ + 0, /* payload size */ + l, /* libnet context */ + 0); /* libnet ptag */ if (t == -1) { - fprintf(stderr, "Can't build ethernet header: %s\n", libnet_geterror(l)); + fprintf(stderr, "Can't build 802.3 header: %s\n", libnet_geterror(l)); goto bad; } - /* - * Write it to the wire. - */ + /* write the packet out */ c = libnet_write(l); - if (c == -1) { fprintf(stderr, "Write error: %s\n", libnet_geterror(l)); @@ -175,7 +148,7 @@ main(int argc, char *argv[]) } else { - fprintf(stderr, "Wrote %d byte CDP packet; check the wire.\n", c); + fprintf(stderr, "Wrote %d byte CDP frame \"%s\"\n", c, argv[2]); } libnet_destroy(l); return (EXIT_SUCCESS); diff --git a/libnet/sample/dhcp_discover.c b/libnet/sample/dhcp_discover.c index 60710b1..dd4c5b7 100644 --- a/libnet/sample/dhcp_discover.c +++ b/libnet/sample/dhcp_discover.c @@ -64,26 +64,28 @@ main(int argc, char *argv[]) char errbuf[LIBNET_ERRBUF_SIZE]; - u_char options_req[] = { LIBNET_DHCP_SUBNETMASK , LIBNET_DHCP_BROADCASTADDR , LIBNET_DHCP_TIMEOFFSET , LIBNET_DHCP_ROUTER , LIBNET_DHCP_DOMAINNAME , LIBNET_DHCP_DNS , LIBNET_DHCP_HOSTNAME }; + u_char options_req[] = { LIBNET_DHCP_SUBNETMASK, + LIBNET_DHCP_BROADCASTADDR, LIBNET_DHCP_TIMEOFFSET, + LIBNET_DHCP_ROUTER, LIBNET_DHCP_DOMAINNAME, + LIBNET_DHCP_DNS, LIBNET_DHCP_HOSTNAME }; u_char *options; u_char enet_dst[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; u_char *tmp; - // have to specify interface if (argc != 2) + { usage(argv[0]); + } intf = argv[1]; - l = libnet_init( - LIBNET_LINK, // injection type - intf, // network interface - errbuf); // errbuf + l = libnet_init(LIBNET_LINK, intf, errbuf); if (!l) { fprintf(stderr, "libnet_init: %s", errbuf); exit(EXIT_FAILURE); } - else { + else + { src_ip = libnet_get_ipaddr4(l);; if ((ethaddr = libnet_get_hwaddr(l)) == NULL) @@ -92,65 +94,64 @@ main(int argc, char *argv[]) exit(EXIT_FAILURE); } - printf("ip addr : %s\n", libnet_addr2name4(src_ip, LIBNET_DONT_RESOLVE)); + printf("ip addr : %s\n", libnet_addr2name4(src_ip, + LIBNET_DONT_RESOLVE)); printf("eth addr : "); - for (i = 0; i < 6; i++) { + for (i = 0; i < 6; i++) + { printf("%2.2x", ethaddr->ether_addr_octet[i]); - if (i != 5) { + if (i != 5) + { printf(":"); } } printf("\n"); - // build options packet + /* build options packet */ i = 0; - options_len = 3; // update total payload size + /* update total payload size */ + options_len = 3; - // we are a discover packet + /* we are a discover packet */ options = malloc(3); - options[i++] = LIBNET_DHCP_MESSAGETYPE; // type - options[i++] = 1; // len - options[i++] = LIBNET_DHCP_MSGDISCOVER; // data + options[i++] = LIBNET_DHCP_MESSAGETYPE; /* type */ + options[i++] = 1; /* len */ + options[i++] = LIBNET_DHCP_MSGDISCOVER; /* data */ orig_len = options_len; - options_len += sizeof(options_req) + 2; // update total payload size + /* update total payload size */ + options_len += sizeof(options_req) + 2; - // workaround for realloc on old machines - // options = realloc(options, options_len); // resize options buffer tmp = malloc(options_len); memcpy(tmp, options, orig_len); free(options); options = tmp; - // we are going to request some parameters - options[i++] = LIBNET_DHCP_PARAMREQUEST; // type - options[i++] = sizeof(options_req); // len - memcpy(options + i, options_req, sizeof(options_req)); // data + /* we are going to request some parameters */ + options[i++] = LIBNET_DHCP_PARAMREQUEST; /* type */ + options[i++] = sizeof(options_req); /* len */ + memcpy(options + i, options_req, sizeof(options_req)); /* data */ i += sizeof(options_req); - // if we have an ip already, let's request it. + /* if we have an ip already, let's request it. */ if (src_ip) { orig_len = options_len; options_len += 2 + sizeof(src_ip); - // workaround for realloc on old machines - // options = realloc(options, options_len); tmp = malloc(options_len); memcpy(tmp, options, orig_len); free(options); options = tmp; - options[i++] = LIBNET_DHCP_DISCOVERADDR; // type - options[i++] = sizeof(src_ip); // len - memcpy(options + i, (char *)&src_ip, sizeof(src_ip));// data + options[i++] = LIBNET_DHCP_DISCOVERADDR; /* type */ + options[i++] = sizeof(src_ip); /* len */ + memcpy(options + i, (char *)&src_ip, sizeof(src_ip)); /* data */ i += sizeof(src_ip); } - // end our options packet - // workaround for realloc on old machines - // options = realloc(options, options_len); // resize options buffer + /* end our options packet */ orig_len = options_len; options_len += 1; tmp = malloc(options_len); @@ -160,15 +161,13 @@ main(int argc, char *argv[]) options[i++] = LIBNET_DHCP_END; - // make sure we are at least the minimum length, if not fill - // this could go in libnet, but we will leave it in the app for now + /* make sure we are at least the minimum length, if not fill */ + /* this could go in libnet, but we will leave it in the app for now */ if (options_len + LIBNET_DHCPV4_H < LIBNET_BOOTP_MIN_LEN) { orig_len = options_len; options_len = LIBNET_BOOTP_MIN_LEN - LIBNET_DHCPV4_H; - // workaround for realloc on old machines - // options = realloc(options, options_len); tmp = malloc(options_len); memcpy(tmp, options, orig_len); free(options); @@ -177,62 +176,57 @@ main(int argc, char *argv[]) memset(options + i, 0, options_len - i); } - // the goodies are here dhcp = libnet_build_dhcpv4( - LIBNET_DHCP_REQUEST, // opcode - 1, // hardware type - 6, // hardware address length - 0, // hop count - 0xdeadbeef, // transaction id - 0, // seconds since bootstrap - 0x8000, // flags - 0, // client ip - 0, // your ip - 0, // server ip - 0, // gateway ip - ethaddr->ether_addr_octet, // client hardware addr - NULL, // server host name - NULL, // boot file - options, // dhcp options stuck in payload since it is dynamic - options_len, // length of options - l, // libnet handle - 0); // libnet id + LIBNET_DHCP_REQUEST, /* opcode */ + 1, /* hardware type */ + 6, /* hardware address length */ + 0, /* hop count */ + 0xdeadbeef, /* transaction id */ + 0, /* seconds since bootstrap */ + 0x8000, /* flags */ + 0, /* client ip */ + 0, /* your ip */ + 0, /* server ip */ + 0, /* gateway ip */ + ethaddr->ether_addr_octet, /* client hardware addr */ + NULL, /* server host name */ + NULL, /* boot file */ + options, /* dhcp options in payload */ + options_len, /* length of options */ + l, /* libnet context */ + 0); /* libnet ptag */ - // wrap it udp = libnet_build_udp( - 68, // source port - 67, // destination port - LIBNET_UDP_H + LIBNET_DHCPV4_H + options_len, // packet size - 0, // checksum - NULL, // payload - 0, // payload size - l, // libnet handle - 0); // libnet id + 68, /* source port */ + 67, /* destination port */ + LIBNET_UDP_H + LIBNET_DHCPV4_H + options_len, /* packet size */ + 0, /* checksum */ + NULL, /* payload */ + 0, /* payload size */ + l, /* libnet context */ + 0); /* libnet ptag */ - // hook me up with some ipv4 ip = libnet_build_ipv4( LIBNET_IPV4_H + LIBNET_UDP_H + LIBNET_DHCPV4_H - + options_len, // length - 0x10, // TOS - 0, // IP ID - 0, // IP Frag - 16, // TTL - IPPROTO_UDP, // protocol - 0, // checksum - src_ip, // src ip - inet_addr("255.255.255.255"), // destination ip - NULL, // payload - 0, // payload size - l, // libnet handle - 0); // libnet id + + options_len, /* length */ + 0x10, /* TOS */ + 0, /* IP ID */ + 0, /* IP Frag */ + 16, /* TTL */ + IPPROTO_UDP, /* protocol */ + 0, /* checksum */ + src_ip, /* src ip */ + inet_addr("255.255.255.255"), /* destination ip */ + NULL, /* payload */ + 0, /* payload size */ + l, /* libnet context */ + 0); /* libnet ptag */ - // we can just autobuild since we arent doing anything tricky t = libnet_autobuild_ethernet( - enet_dst, // ethernet destination - ETHERTYPE_IP, // protocol type - l); // libnet handle + enet_dst, /* ethernet destination */ + ETHERTYPE_IP, /* protocol type */ + l); /* libnet context */ - // write to the wire if (libnet_write(l) == -1) { fprintf(stderr, " %s: libnet_write: %s\n", argv[0], @@ -240,7 +234,6 @@ main(int argc, char *argv[]) exit(EXIT_FAILURE); } - // fill and print stats libnet_stats(l, &ls); fprintf(stderr, "Packets sent: %lld\n" "Packet errors: %lld\n" @@ -248,7 +241,6 @@ main(int argc, char *argv[]) ls.packets_sent, ls.packet_errors, ls.bytes_written); libnet_destroy(l); - // free mem free(options); exit(0); diff --git a/libnet/sample/get_addr.c b/libnet/sample/get_addr.c index 7039f35..9832566 100644 --- a/libnet/sample/get_addr.c +++ b/libnet/sample/get_addr.c @@ -1,5 +1,5 @@ /* - * $Id: get_addr.c,v 1.3 2004/01/03 20:31:01 mike Exp $ + * $Id: get_addr.c,v 1.4 2004/11/09 07:05:07 mike Exp $ * * libnet 1.1 * get_addr.c - Retrieve the MAC and IP address of an interface @@ -76,7 +76,7 @@ main(int argc, char *argv[]) exit(EXIT_FAILURE); } - printf("Interface:\t%s\n", libnet_getdevice(l)); + printf("Interface:\t%s\n", libnet_getdevice(l)); e = libnet_get_hwaddr(l); if (e == NULL) { diff --git a/libnet/sample/hsrp.c b/libnet/sample/hsrp.c new file mode 100644 index 0000000..13cf43b --- /dev/null +++ b/libnet/sample/hsrp.c @@ -0,0 +1,196 @@ +/* + * + * libnet 1.1.2 + * Build a HSRP packet + * + * Copyright (c) 2004 David Barroso Berrueta <tomac@wasahero.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#if (HAVE_CONFIG_H) +#if ((_WIN32) && !(__CYGWIN__)) +#include "../include/win32/config.h" +#else +#include "../include/config.h" +#endif +#endif +#include "./libnet_test.h" + + +int +main(int argc, char *argv[]) +{ + u_int8_t version = LIBNET_HSRP_VERSION; + u_int8_t opcode = LIBNET_HSRP_TYPE_HELLO; + u_int8_t state = LIBNET_HSRP_STATE_ACTIVE; + u_int8_t hello_time = 3; + u_int8_t hold_time = 10; + u_int8_t priority = 1; + u_int8_t group = 1; + u_int8_t reserved = 0; + u_int8_t authdata[8]; + + libnet_t *l; + char *device = NULL; + char src[] = "1.1.1.1"; + char *eth_dst = "DE:AD:00:00:BE:EF"; + char dst[] = "224.0.0.2"; + int port = 1985; + int c; + u_long src_ip, dst_ip; + char errbuf[LIBNET_ERRBUF_SIZE]; + libnet_ptag_t ptag = 0; + + printf("libnet 1.1.2 packet shaping: HSRP[link]\n"); + + /* + * Initialize the library. Root priviledges are required. + */ + l = libnet_init( + LIBNET_LINK_ADV, /* injection type */ + device, /* network interface */ + errbuf); /* error buffer */ + + if (l == NULL) + { + fprintf(stderr, "libnet_init() failed: %s", errbuf); + exit(EXIT_FAILURE); + } + + printf("Using device %s\n", l->device); + + if ((dst_ip = libnet_name2addr4(l, dst, LIBNET_RESOLVE)) == (u_long)-1) + { + fprintf(stderr, "Bad destination IP address: %s\n", dst); + exit(EXIT_FAILURE); + } + + if ((src_ip = libnet_name2addr4(l, src, LIBNET_RESOLVE)) == (u_long)-1) + { + fprintf(stderr, "Bad source IP address: %s\n", src); + exit(EXIT_FAILURE); + } + + memset(authdata, 0, 8); + strncpy(authdata, "cisco", 5); + + + ptag = libnet_build_hsrp( + version, + opcode, + state, + hello_time, /* Recommended hello time */ + hold_time, /* Recommended hold time */ + priority, /* Priority */ + group, /* Group */ + reserved, /* Reserved */ + authdata, /* Password */ + src_ip, /* Virtual IP */ + NULL, + 0, + l, + 0 + ); + + if (ptag == -1) + { + fprintf(stderr, "Can't build HSRP header: %s\n", libnet_geterror(l)); + goto bad; + } + + ptag = libnet_build_udp( + port, /* source port */ + port, /* destination port */ + LIBNET_UDP_H + LIBNET_HSRP_H , /* packet length */ + 0, /* checksum */ + NULL, /* payload */ + 0, /* payload size */ + l, /* libnet handle */ + 0); /* libnet id */ + + if (ptag == -1) + { + fprintf(stderr, "Can't build UDP header: %s\n", libnet_geterror(l)); + goto bad; + } + + ptag = libnet_build_ipv4( + LIBNET_IPV4_H + LIBNET_UDP_H + LIBNET_HSRP_H,/* length */ + 0, /* TOS */ + 666, /* IP ID */ + 0, /* IP Frag */ + 1 , /* TTL */ + IPPROTO_UDP, /* protocol */ + 0, /* checksum */ + src_ip, /* source IP */ + dst_ip, /* destination IP */ + NULL, /* payload */ + 0, /* payload size */ + l, /* libnet handle */ + 0); /* libnet id */ + + if (ptag == -1) + { + fprintf(stderr, "Can't build IP header: %s\n", libnet_geterror(l)); + exit(EXIT_FAILURE); + } + + + eth_dst = libnet_hex_aton(eth_dst, &c); + ptag = libnet_autobuild_ethernet( + eth_dst, /* ethernet destination */ + ETHERTYPE_IP, /* protocol type */ + l); /* libnet handle */ + + free(eth_dst); + if (ptag == -1) + { + fprintf(stderr, "Can't build ethernet header: %s\n", + libnet_geterror(l)); + goto bad; + } + + + /* + * write to the wire + */ + c = libnet_write(l); + if (c == -1) + { + fprintf(stderr, "Write error: %s\n", libnet_geterror(l)); + goto bad; + } + else + { + fprintf(stderr, "Wrote %d byte HSRP packet; check the wire.\n", c); + } + libnet_destroy(l); + return (EXIT_SUCCESS); + bad: + libnet_destroy(l); + return (EXIT_FAILURE); + + return 0; +} diff --git a/libnet/sample/icmp6_echoreq.c b/libnet/sample/icmp6_echoreq.c index 416b2f5..3ef1b91 100644 --- a/libnet/sample/icmp6_echoreq.c +++ b/libnet/sample/icmp6_echoreq.c @@ -123,7 +123,7 @@ main(int argc, char **argv) { for (i = 0; i < packet_amt; i++) { - u_int8_t payload[56]; + char payload[56]; int i; for (i=0; i<56; i++) payload[i]='A'+((char)(i%26)); t = libnet_build_icmpv4_echo(ICMP6_ECHO,0,0,1,0,payload,sizeof(payload),l,t); diff --git a/libnet/sample/ospf_hello.c b/libnet/sample/ospf_hello.c index 8ffe864..3e910e1 100644 --- a/libnet/sample/ospf_hello.c +++ b/libnet/sample/ospf_hello.c @@ -1,5 +1,5 @@ /* - * $Id: ospf_hello.c,v 1.2 2004/01/03 20:31:01 mike Exp $ + * $Id: ospf_hello.c,v 1.3 2004/11/09 07:05:07 mike Exp $ * * libnet 1.1 * Build an OSPF Hello packet @@ -44,22 +44,21 @@ main(int argc, char **argv) int c; libnet_t *l; libnet_ptag_t t; - u_long src, dst, nbr; + u_long src, dst; char errbuf[LIBNET_ERRBUF_SIZE]; - char *to, *from, *neighbor; + char *to, *from; u_char auth[8] = {0,0,0,0,0,0,0,0}; printf("libnet 1.1 OSPF Hello packet shaping[raw]\n"); - if (argc != 4) + if (argc != 3) { usage(argv[0]); } from = argv[1]; to = argv[2]; - neighbor = argv[3]; /* * Initialize the library. Root priviledges are required. @@ -78,7 +77,6 @@ main(int argc, char **argv) /* Too lazy to check for error */ src = libnet_name2addr4(l, from, LIBNET_DONT_RESOLVE); dst = libnet_name2addr4(l, to, LIBNET_DONT_RESOLVE); - nbr = libnet_name2addr4(l, neighbor, LIBNET_DONT_RESOLVE); t = libnet_build_ospfv2_hello( 0xffffffff, /* netmask */ @@ -88,7 +86,6 @@ main(int argc, char **argv) 30, /* dead int */ src, /* router */ src, /* router */ - nbr, /* neighbor */ NULL, /* payload */ 0, /* payload size */ l, /* libnet handle */ diff --git a/libnet/sample/synflood6.c b/libnet/sample/synflood6.c index 6ad2a53..68373b3 100644 --- a/libnet/sample/synflood6.c +++ b/libnet/sample/synflood6.c @@ -165,7 +165,6 @@ main(int argc, char **argv) 0, l, 0); - //libnet_autobuild_ipv6(LIBNET_TCP_H,IPPROTO_TCP,dst_ip,l); } printf("%15s/%5d -> %15s/%5d\n", srcname, |