| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: npf_inet.c,v 1.32 2014/07/20 00:37:41 rmind Exp $ */ | | 1 | /* $NetBSD: npf_inet.c,v 1.33 2015/12/17 12:17:13 mlelstv Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2009-2014 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2009-2014 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This material is based upon work partially supported by The | | 7 | * This material is based upon work partially supported by The |
8 | * NetBSD Foundation under a contract with Mindaugas Rasiukevicius. | | 8 | * NetBSD Foundation under a contract with Mindaugas Rasiukevicius. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -29,38 +29,39 @@ | | | @@ -29,38 +29,39 @@ |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | /* | | 32 | /* |
33 | * Various protocol related helper routines. | | 33 | * Various protocol related helper routines. |
34 | * | | 34 | * |
35 | * This layer manipulates npf_cache_t structure i.e. caches requested headers | | 35 | * This layer manipulates npf_cache_t structure i.e. caches requested headers |
36 | * and stores which information was cached in the information bit field. | | 36 | * and stores which information was cached in the information bit field. |
37 | * It is also responsibility of this layer to update or invalidate the cache | | 37 | * It is also responsibility of this layer to update or invalidate the cache |
38 | * on rewrites (e.g. by translation routines). | | 38 | * on rewrites (e.g. by translation routines). |
39 | */ | | 39 | */ |
40 | | | 40 | |
41 | #include <sys/cdefs.h> | | 41 | #include <sys/cdefs.h> |
42 | __KERNEL_RCSID(0, "$NetBSD: npf_inet.c,v 1.32 2014/07/20 00:37:41 rmind Exp $"); | | 42 | __KERNEL_RCSID(0, "$NetBSD: npf_inet.c,v 1.33 2015/12/17 12:17:13 mlelstv Exp $"); |
43 | | | 43 | |
44 | #include <sys/param.h> | | 44 | #include <sys/param.h> |
45 | #include <sys/types.h> | | 45 | #include <sys/types.h> |
46 | | | 46 | |
47 | #include <net/pfil.h> | | 47 | #include <net/pfil.h> |
48 | #include <net/if.h> | | 48 | #include <net/if.h> |
49 | #include <net/ethertypes.h> | | 49 | #include <net/ethertypes.h> |
50 | #include <net/if_ether.h> | | 50 | #include <net/if_ether.h> |
51 | | | 51 | |
52 | #include <netinet/in_systm.h> | | 52 | #include <netinet/in_systm.h> |
53 | #include <netinet/in.h> | | 53 | #include <netinet/in.h> |
| | | 54 | #include <netinet6/in6_var.h> |
54 | #include <netinet/ip.h> | | 55 | #include <netinet/ip.h> |
55 | #include <netinet/ip6.h> | | 56 | #include <netinet/ip6.h> |
56 | #include <netinet/tcp.h> | | 57 | #include <netinet/tcp.h> |
57 | #include <netinet/udp.h> | | 58 | #include <netinet/udp.h> |
58 | #include <netinet/ip_icmp.h> | | 59 | #include <netinet/ip_icmp.h> |
59 | | | 60 | |
60 | #include "npf_impl.h" | | 61 | #include "npf_impl.h" |
61 | | | 62 | |
62 | /* | | 63 | /* |
63 | * npf_fixup{16,32}_cksum: incremental update of the Internet checksum. | | 64 | * npf_fixup{16,32}_cksum: incremental update of the Internet checksum. |
64 | */ | | 65 | */ |
65 | | | 66 | |
66 | uint16_t | | 67 | uint16_t |
| @@ -737,17 +738,17 @@ npf_npt66_rwr(const npf_cache_t *npc, u_ | | | @@ -737,17 +738,17 @@ npf_npt66_rwr(const npf_cache_t *npc, u_ |
737 | return 0; | | 738 | return 0; |
738 | } | | 739 | } |
739 | | | 740 | |
740 | #if defined(DDB) || defined(_NPF_TESTING) | | 741 | #if defined(DDB) || defined(_NPF_TESTING) |
741 | | | 742 | |
742 | const char * | | 743 | const char * |
743 | npf_addr_dump(const npf_addr_t *addr, int alen) | | 744 | npf_addr_dump(const npf_addr_t *addr, int alen) |
744 | { | | 745 | { |
745 | if (alen == sizeof(struct in_addr)) { | | 746 | if (alen == sizeof(struct in_addr)) { |
746 | struct in_addr ip; | | 747 | struct in_addr ip; |
747 | memcpy(&ip, addr, alen); | | 748 | memcpy(&ip, addr, alen); |
748 | return inet_ntoa(ip); | | 749 | return inet_ntoa(ip); |
749 | } | | 750 | } |
750 | return "[IPv6]"; // XXX | | 751 | return ip6_sprintf(addr); |
751 | } | | 752 | } |
752 | | | 753 | |
753 | #endif | | 754 | #endif |