autogen definitions options; copyright = { date = "2005"; owner = "Aaron Turner"; type = "bsd"; author = <<- EOText Copyright 2000-2005 Aaron Turner For support please use the tcpreplay-users@lists.sourceforge.net mailing list. EOText; }; package = "tcpbridge"; prog-name = "tcpbridge"; prog-title = "Bridge network traffic across two interfaces"; long-opts; gnu-usage; help-value = "H"; save-opts-value = ""; load-opts-value = ""; config-header = "config.h"; include = "#include \"defines.h\"\n" "#include \"tcpbridge.h\"\n" "#include \"common.h\"\n" "#include \"mac.h\"\n" "extern char pcap_version[];\n" "extern tcpbridge_opt_t options;\n"; homerc = "$$/"; explain = <<- EOExplain tcpbridge is a tool for briding network traffic across two interfaces and optionally modifying the packets in betweeen EOExplain; detail = <<- EODetail The basic operation of tcpbridge is to be a network bridge between two subnets. All packets recieved on one interface are sent via the other. Optionally, packets can be edited in a variety of ways according to your needs. EODetail; man-doc = <<- EOMan .SH "SIGNALS" tcpbridge understands the following signals: @enumerate @item @var{SIGUSR1} Suspend tcpbridge @item @var{SIGCONT} Restart tcpbridge @end enumerate .SH "SEE ALSO" tcpdump(1), tcpprep(1), tcprewrite(1), tcpreplay(1) .SH "BUGS" tcpbridge can only send packets as fast as your computer's interface, processor and system bus will allow. Connecting both interfaces to the same subnet may create a broadcast storm and take down the network. Improper use of the packet editing functions may have other undefined and possible negative consequences. Some operating systems by default do not allow for forging source MAC addresses. Please consult your operating system's documentation and the tcpreplay FAQ if you experiance this issue. EOMan; flag = { name = dbug; value = d; arg-type = number; max = 1; immediate; arg-range = "0->5"; arg-default = 0; descrip = "Enable debugging output"; doc = <<- EOText If configured with --enable-debug, then you can specify a verbosity level for debugging output. Higher numbers increase verbosity. EOText; }; /* Verbose decoding via tcpdump */ flag = { ifdef = HAVE_TCPDUMP; name = verbose; value = v; max = 1; immediate; descrip = "Print decoded packets via tcpdump to STDOUT"; settable; doc = ""; }; flag = { ifdef = HAVE_TCPDUMP; name = decode; flags-must = verbose; value = A; arg-type = string; max = 1; descrip = "Arguments passed to tcpdump decoder"; doc = <<- EOText When enabling verbose mode (@var{-v}) you may also specify one or more additional arguments to pass to @code{tcpdump} to modify the way packets are decoded. By default, -n and -l are used. Be sure to quote the arguments like: -A "-axxx" so that they are not interpreted by tcpbridge. The following arguments are vaild: [ -aAeNqRStuvxX ] [ -E spi@ipaddr algo:secret,... ] [ -s snaplen ] EOText; }; /* * Outputs: -i, -I */ flag = { name = intf1; value = i; arg-type = string; max = 1; must-set; descrip = "Primary interface (listen in uni-directional mode)"; doc = ""; }; flag = { name = intf2; value = I; arg-type = string; max = 1; descrip = "Secondary interface (send in uni-directional mode)"; doc = ""; }; flag = { name = unidir; value = u; max = 1; descrip = "Send and receive in only one direction"; doc = <<- EOText Normally, tcpbridge will send and receive traffic in both directions (bi-directionally). However, if you choose this option, traffic will be sent uni-directionally. EOText; }; flag = { name = dmac; value = D; arg-type = string; max = 1; descrip = "Rewrite destination MAC addresses"; flag-code = <<- EODmac int mask = 0; mask = dualmac2hex(OPT_ARG(DMAC), options.intf1_dmac, options.intf2_dmac, strlen(OPT_ARG(DMAC))); options.mac_mask ^= (mask << 2); EODmac; doc = <<- EOText Takes a pair of comma deliminated ethernet MAC addresses which will replace the destination MAC address of outbound packets. The first MAC address will be used for the server traffic and the optional second MAC address will be used for the client traffic. Example: @example --dmac 00:12:13:14:15:16,00:22:33:44:55:66 @end example EOText; }; flag = { name = smac; value = S; arg-type = string; max = 1; descrip = "Rewrite source MAC addresses"; flag-code = <<- EOSmac int mask = 0; mask = dualmac2hex(OPT_ARG(SMAC), options.intf1_smac, options.intf2_smac, strlen(OPT_ARG(SMAC))); options.mac_mask ^= mask; EOSmac; doc = <<- EOText Takes a pair of comma deliminated ethernet MAC addresses which will replace the source MAC address of outbound packets. The first MAC address will be used for the server traffic and the optional second MAC address will be used for the client traffic. Example: @example --smac 00:12:13:14:15:16,00:22:33:44:55:66 @end example EOText; }; flag = { name = limit; value = l; arg-type = number; max = 1; arg-default = -1; arg-range = "0->"; descrip = "Limit the number of packets to send"; doc = <<- EOText By default, tcpbridge will send packets forever or until Ctrl-C. Alternatively, you can specify a maximum number of packets to send. EOText; }; /* Include/Exclude */ flag = { name = include; value = x; arg-type = string; max = 1; descrip = "Include only packets matching rule"; flags-cant = exclude; flag-code = <<- EOInclude char *include; include = safe_strdup(OPT_ARG(INCLUDE)); options.xX.mode = xX_MODE_INCLUDE; if ((options.xX.mode = parse_xX_str(&options.xX, include, &options.bpf)) == 0) errx(1, "Unable to parse include/exclude rule: %s", OPT_ARG(INCLUDE)); free(include); EOInclude; doc = <<- EOText Override default of sending all packets stored in the capture file and only send packets which match the provided rule. Rules can be one of: @table @bullet @item S:,... - Source IP must match specified CIDR(s) @item D:,... - Destination IP must match specified CIDR(s) @item B:,... - Both source and destination IP must match specified CIDR(s) @item E:,... - Either IP must match specified CIDR(s) @item P: - Must be one of the listed packets where the list corresponds to the packet number in the capture file. @example -x P:1-5,9,15,72- @end example would send packets 1 thru 5, the 9th and 15th packet, and packets 72 until the end of the file @item F:'' - BPF filter. See the @file{tcpdump(8)} man page for syntax. @end table EOText; }; flag = { name = exclude; value = X; arg-type = string; max = 1; descrip = "Exclude any packet matching this rule"; flags-cant = include; flag-code = <<- EOExclude char *exclude; exclude = safe_strdup(OPT_ARG(EXCLUDE)); options.xX.mode = xX_MODE_EXCLUDE; if ((options.xX.mode = parse_xX_str(&options.xX, exclude, &options.bpf)) == 0) errx(1, "Unable to parse include/exclude rule: %s", OPT_ARG(EXCLUDE)); free(exclude); EOExclude; doc = <<- EOText Override default of sending all packets stored in the capture file and only send packets which do not match the provided rule. Rules can be one of: @table @bullet @item S:,... - Source IP must not match specified CIDR(s) @item D:,... - Destination IP must not match specified CIDR(s) @item B:,... - Both source and destination IP must not match specified CIDR(s) @item E:,... - Either IP must not match specified CIDR(s) @item P: - Must not be one of the listed packets where the list corresponds to the packet number in the capture file. @example -x P:1-5,9,15,72- @end example would drop packets 1 thru 5, the 9th and 15th packet, and packets 72 until the end of the file @end table EOText; }; /* rewrite 802.1q vlan tags */ flag = { name = vlan; value = T; max = 1; descrip = "Specify 802.1q VLAN tag mode"; arg-type = string; flag-code = <<- EOVlan if (strcmp(OPT_ARG(VLAN), "add") == 0) { options.vlan = VLAN_ADD; } else if (strcmp(OPT_ARG(VLAN), "del") == 0) { options.vlan = VLAN_DEL; } else { errx(1, "Invalid vlan argument '%s'. Must be 'add' or 'del'", OPT_ARG(VLAN)); } EOVlan; doc = <<- EOText Allows you to rewrite ethernet frames to add a 802.1q header to standard 802.3 ethernet headers or remove the 802.1q VLAN tag information. @table @bullet @item @var{add} Rewrites the existing 802.3 ethernet header as an 802.1q VLAN header @item @var{del} Rewrites the existing 802.1q VLAN header as an 802.3 ethernet header EOText; }; flag = { name = vlan_tag; value = t; max = 1; descrip = "Specify the new 802.1q VLAN tag value"; arg-type = number; flags-must = vlan; arg-range = "0->4095"; /* VID's are 12bit unsigned int's */ doc = ""; }; flag = { name = vlan_cfi; value = c; max = 1; descrip = "Specify the 802.1q VLAN CFI value"; arg-type = number; flags-must = vlan; arg-range = "0->1"; /* one bit */ doc = ""; }; flag = { name = vlan_pri; value = p; max = 1; descrip = "Specify the 802.1q VLAN priority"; flags-must = vlan; arg-type = number; arg-range = "0->7"; /* one byte */ doc = ""; }; flag = { name = pid; value = P; descrip = "Print the PID of tcpbridge at startup"; flag-code = <<- EOPid fprintf(stderr, "PID: %hu\n", getpid()); EOPid; doc = ""; }; flag = { name = version; value = V; descrip = "Print version information"; flag-code = <<- EOVersion fprintf(stderr, "tcpbridge version: %s (build %s)", VERSION, svn_version()); #ifdef DEBUG fprintf(stderr, " (debug)"); #endif fprintf(stderr, "\n"); fprintf(stderr, "Copyright 2001-2005 by Aaron Turner \n"); fprintf(stderr, "Compiled against libnet: %s\n", LIBNET_VERSION); fprintf(stderr, "Compiled against libpcap: %s\n", pcap_version); #ifdef ENABLE_64BITS fprintf(stderr, "64 bit packet counters: enabled\n"); #else fprintf(stderr, "64 bit packet counters: disabled\n"); #endif #ifdef HAVE_TCPDUMP fprintf(stderr, "Verbose printing via tcpdump: enabled\n"); #else fprintf(stderr, "Verbose printing via tcpdump: disabled\n"); #endif exit(0); EOVersion; doc = ""; }; flag = { name = less-help; value = "h"; immediate; descrip = "Display less usage information and exit"; flag-code = <<- EOHelp USAGE(EXIT_FAILURE); EOHelp; doc = ""; };