Update to FreeBSD head 2018-06-01

Git mirror commit fb63610a69b0eb7f69a201ba05c4c1a7a2739cf9.

Update #3472.
This commit is contained in:
Sebastian Huber
2018-08-21 13:47:02 +02:00
parent 2df56dbd60
commit bcdce02d9b
340 changed files with 27754 additions and 11720 deletions

View File

@@ -22,22 +22,10 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#ifdef _WIN32
#include <pcap-stdinc.h>
#else /* _WIN32 */
#if HAVE_INTTYPES_H
#include <inttypes.h>
#elif HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef HAVE_SYS_BITYPES_H
#include <sys/bitypes.h>
#endif
#include <sys/types.h>
#endif /* _WIN32 */
#include <pcap-types.h>
#include <stdio.h>
#include <string.h>
@@ -49,266 +37,290 @@
#endif
char *
bpf_image(p, n)
const struct bpf_insn *p;
int n;
bpf_image(const struct bpf_insn *p, int n)
{
int v;
const char *fmt, *op;
const char *op;
static char image[256];
char operand[64];
char operand_buf[64];
const char *operand;
v = p->k;
switch (p->code) {
default:
op = "unimp";
fmt = "0x%x";
v = p->code;
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "0x%x", p->code);
operand = operand_buf;
break;
case BPF_RET|BPF_K:
op = "ret";
fmt = "#%d";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "#%d", p->k);
operand = operand_buf;
break;
case BPF_RET|BPF_A:
op = "ret";
fmt = "";
operand = "";
break;
case BPF_LD|BPF_W|BPF_ABS:
op = "ld";
fmt = "[%d]";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "[%d]", p->k);
operand = operand_buf;
break;
case BPF_LD|BPF_H|BPF_ABS:
op = "ldh";
fmt = "[%d]";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "[%d]", p->k);
operand = operand_buf;
break;
case BPF_LD|BPF_B|BPF_ABS:
op = "ldb";
fmt = "[%d]";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "[%d]", p->k);
operand = operand_buf;
break;
case BPF_LD|BPF_W|BPF_LEN:
op = "ld";
fmt = "#pktlen";
operand = "#pktlen";
break;
case BPF_LD|BPF_W|BPF_IND:
op = "ld";
fmt = "[x + %d]";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "[x + %d]", p->k);
operand = operand_buf;
break;
case BPF_LD|BPF_H|BPF_IND:
op = "ldh";
fmt = "[x + %d]";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "[x + %d]", p->k);
operand = operand_buf;
break;
case BPF_LD|BPF_B|BPF_IND:
op = "ldb";
fmt = "[x + %d]";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "[x + %d]", p->k);
operand = operand_buf;
break;
case BPF_LD|BPF_IMM:
op = "ld";
fmt = "#0x%x";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "#0x%x", p->k);
operand = operand_buf;
break;
case BPF_LDX|BPF_IMM:
op = "ldx";
fmt = "#0x%x";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "#0x%x", p->k);
operand = operand_buf;
break;
case BPF_LDX|BPF_MSH|BPF_B:
op = "ldxb";
fmt = "4*([%d]&0xf)";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "4*([%d]&0xf)", p->k);
operand = operand_buf;
break;
case BPF_LD|BPF_MEM:
op = "ld";
fmt = "M[%d]";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "M[%d]", p->k);
operand = operand_buf;
break;
case BPF_LDX|BPF_MEM:
op = "ldx";
fmt = "M[%d]";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "M[%d]", p->k);
operand = operand_buf;
break;
case BPF_ST:
op = "st";
fmt = "M[%d]";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "M[%d]", p->k);
operand = operand_buf;
break;
case BPF_STX:
op = "stx";
fmt = "M[%d]";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "M[%d]", p->k);
operand = operand_buf;
break;
case BPF_JMP|BPF_JA:
op = "ja";
fmt = "%d";
v = n + 1 + p->k;
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "%d", n + 1 + p->k);
operand = operand_buf;
break;
case BPF_JMP|BPF_JGT|BPF_K:
op = "jgt";
fmt = "#0x%x";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "#0x%x", p->k);
operand = operand_buf;
break;
case BPF_JMP|BPF_JGE|BPF_K:
op = "jge";
fmt = "#0x%x";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "#0x%x", p->k);
operand = operand_buf;
break;
case BPF_JMP|BPF_JEQ|BPF_K:
op = "jeq";
fmt = "#0x%x";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "#0x%x", p->k);
operand = operand_buf;
break;
case BPF_JMP|BPF_JSET|BPF_K:
op = "jset";
fmt = "#0x%x";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "#0x%x", p->k);
operand = operand_buf;
break;
case BPF_JMP|BPF_JGT|BPF_X:
op = "jgt";
fmt = "x";
operand = "x";
break;
case BPF_JMP|BPF_JGE|BPF_X:
op = "jge";
fmt = "x";
operand = "x";
break;
case BPF_JMP|BPF_JEQ|BPF_X:
op = "jeq";
fmt = "x";
operand = "x";
break;
case BPF_JMP|BPF_JSET|BPF_X:
op = "jset";
fmt = "x";
operand = "x";
break;
case BPF_ALU|BPF_ADD|BPF_X:
op = "add";
fmt = "x";
operand = "x";
break;
case BPF_ALU|BPF_SUB|BPF_X:
op = "sub";
fmt = "x";
operand = "x";
break;
case BPF_ALU|BPF_MUL|BPF_X:
op = "mul";
fmt = "x";
operand = "x";
break;
case BPF_ALU|BPF_DIV|BPF_X:
op = "div";
fmt = "x";
operand = "x";
break;
case BPF_ALU|BPF_MOD|BPF_X:
op = "mod";
fmt = "x";
operand = "x";
break;
case BPF_ALU|BPF_AND|BPF_X:
op = "and";
fmt = "x";
operand = "x";
break;
case BPF_ALU|BPF_OR|BPF_X:
op = "or";
fmt = "x";
operand = "x";
break;
case BPF_ALU|BPF_XOR|BPF_X:
op = "xor";
fmt = "x";
operand = "x";
break;
case BPF_ALU|BPF_LSH|BPF_X:
op = "lsh";
fmt = "x";
operand = "x";
break;
case BPF_ALU|BPF_RSH|BPF_X:
op = "rsh";
fmt = "x";
operand = "x";
break;
case BPF_ALU|BPF_ADD|BPF_K:
op = "add";
fmt = "#%d";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "#%d", p->k);
operand = operand_buf;
break;
case BPF_ALU|BPF_SUB|BPF_K:
op = "sub";
fmt = "#%d";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "#%d", p->k);
operand = operand_buf;
break;
case BPF_ALU|BPF_MUL|BPF_K:
op = "mul";
fmt = "#%d";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "#%d", p->k);
operand = operand_buf;
break;
case BPF_ALU|BPF_DIV|BPF_K:
op = "div";
fmt = "#%d";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "#%d", p->k);
operand = operand_buf;
break;
case BPF_ALU|BPF_MOD|BPF_K:
op = "mod";
fmt = "#%d";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "#%d", p->k);
operand = operand_buf;
break;
case BPF_ALU|BPF_AND|BPF_K:
op = "and";
fmt = "#0x%x";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "#0x%x", p->k);
operand = operand_buf;
break;
case BPF_ALU|BPF_OR|BPF_K:
op = "or";
fmt = "#0x%x";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "#0x%x", p->k);
operand = operand_buf;
break;
case BPF_ALU|BPF_XOR|BPF_K:
op = "xor";
fmt = "#0x%x";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "#0x%x", p->k);
operand = operand_buf;
break;
case BPF_ALU|BPF_LSH|BPF_K:
op = "lsh";
fmt = "#%d";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "#%d", p->k);
operand = operand_buf;
break;
case BPF_ALU|BPF_RSH|BPF_K:
op = "rsh";
fmt = "#%d";
(void)pcap_snprintf(operand_buf, sizeof operand_buf, "#%d", p->k);
operand = operand_buf;
break;
case BPF_ALU|BPF_NEG:
op = "neg";
fmt = "";
operand = "";
break;
case BPF_MISC|BPF_TAX:
op = "tax";
fmt = "";
operand = "";
break;
case BPF_MISC|BPF_TXA:
op = "txa";
fmt = "";
operand = "";
break;
}
(void)pcap_snprintf(operand, sizeof operand, fmt, v);
if (BPF_CLASS(p->code) == BPF_JMP && BPF_OP(p->code) != BPF_JA) {
(void)pcap_snprintf(image, sizeof image,
"(%03d) %-8s %-16s jt %d\tjf %d",