packages: tcpdump/tcpdump-4.0.0-hip.04.patch (NEW) - HIP patch from http://...
gotar
gotar at pld-linux.org
Sun Sep 5 13:47:55 CEST 2010
Author: gotar Date: Sun Sep 5 11:47:55 2010 GMT
Module: packages Tag: HEAD
---- Log message:
- HIP patch from http://hipl.hiit.fi/hipl/hipl.tar.gz
---- Files affected:
packages/tcpdump:
tcpdump-4.0.0-hip.04.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: packages/tcpdump/tcpdump-4.0.0-hip.04.patch
diff -u /dev/null packages/tcpdump/tcpdump-4.0.0-hip.04.patch:1.1
--- /dev/null Sun Sep 5 13:47:55 2010
+++ packages/tcpdump/tcpdump-4.0.0-hip.04.patch Sun Sep 5 13:47:50 2010
@@ -0,0 +1,1532 @@
+diff -N -r -u --strip-trailing-cr tcpdump-orig/configure.in tcpdump/configure.in
+--- tcpdump-orig/configure.in 2009-05-20 10:29:46.000000000 +0200
++++ tcpdump/configure.in 2009-05-17 12:13:13.000000000 +0200
+@@ -158,7 +158,7 @@
+ --disable-ipv6 disable ipv6 support],
+ [ case "$enableval" in
+ yes) AC_MSG_RESULT(yes)
+- LOCALSRC="print-ip6.c print-ip6opts.c print-mobility.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c $LOCALSRC"
++ LOCALSRC="print-ip6.c print-ip6opts.c print-mobility.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c print-hip.c $LOCALSRC"
+ AC_DEFINE(INET6)
+ ipv6=yes
+ ;;
+diff -N -r -u --strip-trailing-cr tcpdump-orig/interface.h tcpdump/interface.h
+--- tcpdump-orig/interface.h 2009-05-20 10:29:46.000000000 +0200
++++ tcpdump/interface.h 2009-05-17 12:15:00.000000000 +0200
+@@ -336,6 +336,7 @@
+ extern int rt6_print(const u_char *, const u_char *);
+ extern void ospf6_print(const u_char *, u_int);
+ extern void dhcp6_print(const u_char *, u_int);
++extern void hip_print(const u_char *, u_int);
+ #endif /*INET6*/
+ extern u_short in_cksum(const u_short *, register u_int, int);
+ extern u_int16_t in_cksum_shouldbe(u_int16_t, u_int16_t);
+diff -N -r -u --strip-trailing-cr tcpdump-orig/ipproto.c tcpdump/ipproto.c
+--- tcpdump-orig/ipproto.c 2009-05-20 10:29:46.000000000 +0200
++++ tcpdump/ipproto.c 2009-05-18 18:56:10.000000000 +0200
+@@ -55,6 +55,7 @@
+ { IPPROTO_PGM, "PGM" },
+ { IPPROTO_SCTP, "SCTP" },
+ { IPPROTO_MOBILITY, "Mobility" },
++ { IPPROTO_HIP, "HIP" },
+ { 0, NULL }
+ };
+
+diff -N -r -u --strip-trailing-cr tcpdump-orig/ipproto.h tcpdump/ipproto.h
+--- tcpdump-orig/ipproto.h 2009-05-20 10:29:46.000000000 +0200
++++ tcpdump/ipproto.h 2009-05-17 12:33:07.000000000 +0200
+@@ -142,3 +142,6 @@
+ #ifndef IPPROTO_MOBILITY
+ #define IPPROTO_MOBILITY 135
+ #endif
++#ifndef IPPROTO_HIP
++#define IPPROTO_HIP 139
++#endif
+diff -N -r -u --strip-trailing-cr tcpdump-orig/Makefile.in tcpdump/Makefile.in
+--- tcpdump-orig/Makefile.in 2009-05-20 10:29:46.000000000 +0200
++++ tcpdump/Makefile.in 2009-05-17 12:20:28.000000000 +0200
+@@ -76,7 +76,7 @@
+ print-domain.c print-dtp.c print-dvmrp.c print-enc.c print-egp.c \
+ print-eap.c print-eigrp.c\
+ print-esp.c print-ether.c print-fddi.c print-fr.c \
+- print-gre.c print-hsrp.c print-icmp.c print-igmp.c \
++ print-gre.c print-hip.c print-hsrp.c print-icmp.c print-igmp.c \
+ print-igrp.c print-ip.c print-ipcomp.c print-ipfc.c \
+ print-ipx.c print-isoclns.c print-juniper.c print-krb.c \
+ print-l2tp.c print-lane.c print-ldp.c print-lldp.c print-llc.c \
+diff -N -r -u --strip-trailing-cr tcpdump-orig/print-hip.c tcpdump/print-hip.c
+--- tcpdump-orig/print-hip.c 1970-01-01 01:00:00.000000000 +0100
++++ tcpdump/print-hip.c 2009-07-28 00:47:40.000000000 +0200
+@@ -0,0 +1,1389 @@
++/*
++ * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994
++ * The Regents of the University of California. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that: (1) source code distributions
++ * retain the above copyright notice and this paragraph in its entirety, (2)
++ * distributions including binary code include the above copyright notice and
++ * this paragraph in its entirety in the documentation or other materials
++ * provided with the distribution, and (3) all advertising materials mentioning
++ * features or use of this software display the following acknowledgement:
++ * ``This product includes software developed by the University of California,
++ * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
++ * the University nor the names of its contributors may be used to endorse
++ * or promote products derived from this software without specific prior
++ * written permission.
++ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
++ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
++ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
++ *
++ * Support for dissecting Host Identity Protocol (HIP)
++ * RFCs 5201 - 5206, draft-ietf-hip-cert-00, draft-ietf-hip-nat-traversal-06
++ *
++ * Author: Samu Varjonen <samu.varjonen at hiit.fi>
++ * based on patch created by
++ * Mika Kousa <mika.kousa at iki.fi>
++ * Kristian Slavov <kslavov at piuha.net>
++ *
++ */
++
++#ifdef HAVE_CONFIG_H
++#include "config.h"
++#endif
++
++#include <sys/param.h>
++#include <sys/time.h>
++#include <sys/types.h>
++#include <sys/socket.h>
++
++#include <netinet/in.h>
++
++#include <stdio.h>
++#include <stdlib.h>
++#include <unistd.h>
++#include <string.h>
++
++#include <tcpdump-stdinc.h>
++
++#include "interface.h"
++#include "extract.h"
++#include "addrtoname.h"
++
++#define HIP_HI_DSA 3
++#define HIP_HI_RSA 5
++
++/* RFC 5201 */
++#define HIP_I1 1
++#define HIP_R1 2
++#define HIP_I2 3
++#define HIP_R2 4
++#define HIP_UPDATE 16
++#define HIP_NOTIFY 17
++#define HIP_CLOSE 18
++#define HIP_CLOSE_ACK 19
++
++/* RFC 5202 */
++#define HIP_ESP_RESERVED 0
++#define HIP_ESP_AES_SHA1 1
++#define HIP_ESP_3DES_SHA1 2
++#define HIP_ESP_3DES_MD5 3
++#define HIP_ESP_BLOWFISH_SHA1 4
++#define HIP_ESP_NULL_SHA1 5
++#define HIP_ESP_NULL_MD5 6
++
++/* RFC 5201 */
++#define HIP_DH_RESERVED 0
++#define HIP_DH_384 1
++#define HIP_DH_OAKLEY_1 2
++#define HIP_DH_OAKLEY_5 3
++#define HIP_DH_OAKLEY_15 4
++#define HIP_DH_OAKLEY_17 5
++#define HIP_DH_OAKLEY_18 6
++
++/**/
++#define HIP_NAT_TRAVERSAL_MODE_RESERVED 0
++#define HIP_NAT_TRAVERSAL_MODE_UDP 1
++#define HIP_NAT_TRAVERSAL_MODE_ICE_STUN_UDP 2
++
++/* HIP TLV parameters listed in order of RFCs */
++
++/* RFC 5201 */
++#define HIP_PARAM_R1_COUNTER 128
++#define HIP_PARAM_PUZZLE 257
++#define HIP_PARAM_SOLUTION 321
++#define HIP_PARAM_SEQ 385
++#define HIP_PARAM_ACK 449
++#define HIP_PARAM_DIFFIE_HELLMAN 513
++#define HIP_PARAM_HIP_TRANSFORM 577
++#define HIP_PARAM_ENCRYPTED 641
++#define HIP_PARAM_HOST_ID 705
++/* Type number defined in RFC 5201 contents
++ in draft-ietf-hip-cert-00 */
++#define HIP_PARAM_CERT 768
++#define HIP_PARAM_NOTIFICATION 832
++#define HIP_PARAM_ECHO_REQUEST_SIGNED 897
++#define HIP_PARAM_ECHO_RESPONSE_SIGNED 961
++#define HIP_PARAM_HMAC 61505
++#define HIP_PARAM_HMAC_2 61569
++#define HIP_PARAM_HIP_SIGNATURE_2 61633
++#define HIP_PARAM_HIP_SIGNATURE 61697
++#define HIP_PARAM_ECHO_REQUEST_UNSIGNED 63661
++#define HIP_PARAM_ECHO_RESPONSE_UNSIGNED 63425
++/* RFC 5202 */
++#define HIP_PARAM_ESP_INFO 65
++#define HIP_PARAM_ESP_TRANSFORM 4095
++/* RFC 5203 */
++#define HIP_PARAM_REG_INFO 930
++#define HIP_PARAM_REG_REQUEST 932
++#define HIP_PARAM_REG_RESPONSE 934
++#define HIP_PARAM_REG_FAILED 936
++/* RFC 5204 */
++#define HIP_PARAM_FROM 65498
++#define HIP_PARAM_RVS_HMAC 65500
++#define HIP_PARAM_VIA_RVS 65502
++/* RFC 5206 */
++#define HIP_PARAM_LOCATOR 193
++/* draft-ietf-hip-nat-raversal-06.txt */
++#define HIP_PARAM_NAT_TRAVERSAL_MODE 608
++#define HIP_PARAM_TRANSACTION_PACING 610
++#define HIP_PARAM_REG_FROM 950
++#define HIP_PARAM_RELAY_FROM 63998
++#define HIP_PARAM_RELAY_TO 64002
++
++/* Bit masks */
++#define HIP_PARAM_CRITICAL_BIT 0x0001
++/* See RFC 5201 section 5.1 */
++#define HIP_PACKET_TYPE_MASK 0x7F
++/* draft-ietf-shim6-proto-12 see section 5.3 */
++#define HIP_SHIM6_FIXED_BIT_P_MASK 0x80
++#define HIP_SHIM6_FIXED_BIT_S_MASK 0x01
++/* 00001110 Excluding the shim6 compatibility bit */
++#define HIP_RESERVED_MASK 0x0E
++#define HIP_VERSION_MASK 0xF0
++#define HIP_CONTROL_A_MASK 0x0001
++#define HIP_CONTROL_C_MASK 0x0002
++
++#define HI_HDR_FLAGS_MASK 0xFFFF0000
++#define HI_HDR_PROTO_MASK 0x0000FF00
++#define HI_HDR_ALG_MASK 0x000000FF
++
++#define HIP_LOCATOR_RESERVED_MASK 0xFE
++#define HIP_LOCATOR_PREFERRED_MASK 0x01
++
++#define HIP_TRANSFORM_HIP_MAX 6
++#define HIP_TRANSFORM_ESP_MAX 6
++#define HIP_NAT_TRAVERSAL_MODE_MAX 6
++#define HIP_MAX_PACKET 2048
++#define HIP_PUZZLE_OPAQUE_LEN 2
++
++#define HIP_AH_SHA_LEN 20
++
++typedef uint16_t hip_tlv_type_t;
++typedef uint16_t hip_tlv_len_t;
++
++/* Returns length of TLV option (contents) with padding. */
++#define HIP_LEN_PAD(len) \
++ ((((len) & 0x07) == 0) ? (len) : ((((len) >> 3) << 3) + 8))
++
++/* Structs */
++struct hip_common {
++ uint8_t payload_proto;
++ uint8_t payload_len;
++ uint8_t type_hdr;
++ uint8_t ver_res;
++
++ uint16_t checksum;
++ uint16_t control;
++
++ struct in6_addr hits; /* Sender HIT */
++ struct in6_addr hitr; /* Receiver HIT */
++} __attribute__ ((packed));
++
++struct hip_tlv_common {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++} __attribute__ ((packed));
++
++struct hip_r1_counter {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++
++ uint32_t reserved;
++ uint64_t generation;
++} __attribute__ ((packed));
++
++struct hip_puzzle {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++
++ uint8_t K;
++ uint8_t lifetime;
++ uint8_t opaque[HIP_PUZZLE_OPAQUE_LEN];
++ uint64_t I;
++} __attribute__ ((packed));
++
++struct hip_solution {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++
++ uint8_t K;
++ uint8_t reserved;
++ uint8_t opaque[HIP_PUZZLE_OPAQUE_LEN];
++ uint64_t I;
++ uint64_t J;
++} __attribute__ ((packed));
++
++struct hip_seq {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++
++ uint32_t update_id;
++} __attribute__ ((packed));
++
++struct hip_ack {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++
++ uint32_t peer_update_id; /* n items */
++} __attribute__ ((packed));
++
++struct hip_diffie_hellman {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++
++ uint8_t group_id;
++ /* fixed part ends */
++ uint8_t public_value[0];
++} __attribute__ ((packed));
++
++typedef uint16_t hip_transform_suite_t;
++
++struct hip_hip_transform {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++
++ hip_transform_suite_t suite_id[HIP_TRANSFORM_HIP_MAX];
++} __attribute__ ((packed));
++
++struct hip_encrypted_aes_sha1 {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++
++ uint32_t reserved;
++ uint8_t iv[16];
++ /* fixed part ends */
++} __attribute__ ((packed));
++
++struct hip_encrypted_3des_sha1 {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++
++ uint32_t reserved;
++ uint8_t iv[8];
++ /* fixed part ends */
++} __attribute__ ((packed));
++
++struct hip_encrypted_null_sha1 {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++
++ uint32_t reserved;
++ /* fixed part ends */
++} __attribute__ ((packed));
++
++struct hip_host_id_key_rdata {
++ uint16_t flags;
++ uint8_t protocol;
++ uint8_t algorithm;
++
++ /* fixed part ends */
++} __attribute__ ((packed));
++
++struct hip_host_id {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++
++ uint16_t hi_length;
++ uint16_t di_type_length;
++
++ struct hip_host_id_key_rdata rdata;
++ /* fixed part ends */
++} __attribute__ ((packed));
++
++struct hip_cert {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++
++ uint8_t cert_group;
++ uint8_t cert_count;
++ uint8_t cert_id;
++ uint8_t cert_type;
++ /* end of fixed part */
++} __attribute__ ((packed));
++
++struct hip_notification {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++
++ uint16_t reserved;
++ uint16_t msgtype;
++ /* end of fixed part */
++} __attribute__ ((packed));
++
++struct hip_echo_request {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++ /* opaque */
++} __attribute__ ((packed));
++
++struct hip_echo_response {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++ /* opaque */
++} __attribute__ ((packed));
++
++struct hip_hmac {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++
++ uint8_t hmac_data[HIP_AH_SHA_LEN];
++} __attribute__ ((packed));
++
++/* HMAC2 is the same as above */
++
++/* HIP SIGNATURE2 is the same as below */
++
++struct hip_signature {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++
++ uint8_t algorithm;
++ uint8_t signature[0]; /* variable length */
++ /* fixed part end */
++} __attribute__ ((packed));
++
++/* HIP_ECHO_REQUEST_UNSIGNED same as signed version above */
++
++/* HIP_ECHO_RESPONSE_UNSIGNED same as signed version above */
++
++struct hip_esp_info {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++
++ uint16_t reserved;
++ uint16_t keymat_index;
++ uint32_t old_spi;
++ uint32_t new_spi;
++} __attribute__ ((packed));
++
++struct hip_esp_transform {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++
++ uint16_t reserved;
++
++ hip_transform_suite_t suite_id[HIP_TRANSFORM_ESP_MAX];
++} __attribute__ ((packed));
++
++struct hip_reg_info {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++
++ uint8_t min_lifetime;
++ uint8_t max_lifetime;
++
++ uint8_t reg_type[0]; /* Variable */
++} __attribute__ ((packed));
++
++struct hip_reg_request_response {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++
++ uint8_t lifetime;
++ uint8_t reg_type[0]; /* Variable */
++} __attribute__ ((packed));
++
++/* REG_REQUEST is exactly like RESPONSE see above */
++
++struct hip_reg_failed {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++
++ uint8_t failure_type;
++ uint8_t reg_type[0]; /* Variable */
++} __attribute__ ((packed));
++
++struct hip_from {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++ uint8_t address[16];
++} __attribute__ ((packed));
++
++struct hip_rvs_hmac {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++ uint8_t hmac_data[HIP_AH_SHA_LEN];
++} __attribute__ ((packed));
++
++struct hip_via_rvs {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++ uint8_t address[16];
++ /* the rest of the addresses */
++} __attribute__ ((packed));
++
++/* Type 0 and 1 */
++struct hip_locator_info_addr_item {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++ uint8_t traffic_type;
++ uint8_t locator_type;
++ uint8_t locator_length;
++ uint8_t reserved;
++ uint32_t lifetime;
++ /* end of fixed part - locator of arbitrary length follows but
++ currently support only IPv6 */
++ uint8_t locator[16];
++} __attribute__ ((packed));
++
++/* Type 2 */
++struct hip_locator_info_addr_item2 {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++ uint8_t traffic_type;
++ uint8_t locator_type;
++ uint8_t locator_length;
++ uint8_t reserved;
++ uint32_t lifetime;
++ uint16_t transport_port;
++ uint8_t transport_protocol;
++ uint8_t kind;
++ uint32_t priority;
++ uint32_t spi;
++ /* end of fixed part - locator of arbitrary length follows but
++ currently support only IPv6 */
++ uint8_t locator[16];
++} __attribute__ ((packed));
++
++struct hip_nat_traversal_mode {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++
++ uint16_t reserved;
++
++ hip_transform_suite_t suite_id[HIP_NAT_TRAVERSAL_MODE_MAX];
++} __attribute__ ((packed));
++
++struct hip_transaction_pacing {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++
++ uint32_t min_ta;
++} __attribute__ ((packed));
++
++struct hip_reg_from {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++
++ uint16_t port;
++ uint8_t protocol;
++ uint8_t reserved;
++ uint8_t address[16];
++} __attribute__ ((packed));
++
++struct hip_relay_from {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++
++ uint16_t port;
++ uint8_t protocol;
++ uint8_t reserved;
++ uint8_t address[16];
++} __attribute__ ((packed));
++
++struct hip_relay_to {
++ hip_tlv_type_t type;
++ hip_tlv_len_t length;
++
++ uint16_t port;
++ uint8_t protocol;
++ uint8_t reserved;
++ uint8_t address[16];
++} __attribute__ ((packed));
++
++/*******************************************************************************
++* Token arrays *
++*******************************************************************************/
++
++static struct tok hip_types[] = {
++ { HIP_I1, "I1" },
++ { HIP_R1, "R1" },
++ { HIP_I2, "I2" },
++ { HIP_R2, "R2" },
++ { HIP_UPDATE, "UPDATE" },
++ { HIP_NOTIFY, "NOTIFY" },
++ { HIP_CLOSE, "CLOSE" },
++ { HIP_CLOSE_ACK, "CLOSE_ACK" },
++ { 0, NULL }
++};
++
++static struct tok hip_param_types[] = {
++ { HIP_PARAM_R1_COUNTER, "R1 COUNTER" },
++ { HIP_PARAM_PUZZLE, "PUZZLE" },
++ { HIP_PARAM_SOLUTION, "SOLUTION" },
++ { HIP_PARAM_SEQ, "SEQ" },
++ { HIP_PARAM_ACK, "ACK" },
++ { HIP_PARAM_DIFFIE_HELLMAN, "DIFFIE_HELLMAN" },
++ { HIP_PARAM_HIP_TRANSFORM, "HIP_TRANSFORM" },
++ { HIP_PARAM_ENCRYPTED, "ENCRYPTED" },
++ { HIP_PARAM_HOST_ID, "HOST_ID" },
++ { HIP_PARAM_CERT, "CERT" },
++ { HIP_PARAM_NOTIFICATION, "NOTIFICATION" },
++ { HIP_PARAM_ECHO_REQUEST_SIGNED, "ECHO_REQUEST_SIGNED" },
++ { HIP_PARAM_ECHO_RESPONSE_SIGNED, "ECHO_RESPONSE_SIGNED" },
++ { HIP_PARAM_HMAC, "HMAC" },
++ { HIP_PARAM_HMAC_2, "HMAC_2" },
++ { HIP_PARAM_HIP_SIGNATURE_2, "HIP_SIGNATURE_2" },
++ { HIP_PARAM_HIP_SIGNATURE, "HIP_SIGNATURE" },
++ { HIP_PARAM_ECHO_REQUEST_UNSIGNED, "ECHO_REQUEST_UNSIGNED" },
++ { HIP_PARAM_ECHO_RESPONSE_UNSIGNED, "ECHO_RESPONSE_UNSIGNED" },
++ { HIP_PARAM_ESP_INFO, "ESP_INFO" },
<<Diff was trimmed, longer than 597 lines>>
More information about the pld-cvs-commit
mailing list