xref: /freebsd/sbin/ipf/libipf/icmptypes.c (revision 41edb306f05651fcaf6c74f9e3557f59f80292e1)
1 /*
2  * Copyright (C) 2012 by Darren Reed.
3  *
4  * See the IPFILTER.LICENCE file for details on licencing.
5  *
6  * $Id$
7  */
8 #include "ipf.h"
9 
10 #ifndef USE_INET6
11 # undef		ICMP6_ECHO_REQUEST
12 # define	ICMP6_ECHO_REQUEST	0
13 # undef		ICMP6_ECHO_REPLY
14 # define	ICMP6_ECHO_REPLY	0
15 # undef		ICMP6_NI_QUERY
16 # define	ICMP6_NI_QUERY		0
17 # undef		ICMP6_NI_REPLY
18 # define	ICMP6_NI_REPLY		0
19 # undef		ICMP6_PARAM_PROB
20 # define	ICMP6_PARAM_PROB	0
21 # undef		ND_ROUTER_ADVERT
22 # define	ND_ROUTER_ADVERT	0
23 # undef		ND_ROUTER_SOLICIT
24 # define	ND_ROUTER_SOLICIT	0
25 # undef		ICMP6_TIME_EXCEEDED
26 # define	ICMP6_TIME_EXCEEDED	0
27 # undef		ICMP6_DST_UNREACH
28 # define	ICMP6_DST_UNREACH	0
29 # undef		ICMP6_PACKET_TOO_BIG
30 # define	ICMP6_PACKET_TOO_BIG	0
31 # undef		MLD_LISTENER_QUERY
32 # define	MLD_LISTENER_QUERY	0
33 # undef		MLD_LISTENER_REPORT
34 # define	MLD_LISTENER_REPORT	0
35 # undef		MLD_LISTENER_DONE
36 # define	MLD_LISTENER_DONE	0
37 # undef		ICMP6_MEMBERSHIP_QUERY
38 # define	ICMP6_MEMBERSHIP_QUERY	0
39 # undef		ICMP6_MEMBERSHIP_REPORT
40 # define	ICMP6_MEMBERSHIP_REPORT	0
41 # undef		ICMP6_MEMBERSHIP_REDUCTION
42 # define	ICMP6_MEMBERSHIP_REDUCTION	0
43 # undef		ND_NEIGHBOR_ADVERT
44 # define	ND_NEIGHBOR_ADVERT	0
45 # undef		ND_NEIGHBOR_SOLICIT
46 # define	ND_NEIGHBOR_SOLICIT	0
47 # undef		ICMP6_ROUTER_RENUMBERING
48 # define	ICMP6_ROUTER_RENUMBERING	0
49 # undef		ICMP6_WRUREQUEST
50 # define	ICMP6_WRUREQUEST	0
51 # undef		ICMP6_WRUREPLY
52 # define	ICMP6_WRUREPLY		0
53 # undef		ICMP6_FQDN_QUERY
54 # define	ICMP6_FQDN_QUERY	0
55 # undef		ICMP6_FQDN_REPLY
56 # define	ICMP6_FQDN_REPLY	0
57 #else
58 # if !defined(MLD_LISTENER_QUERY)
59 #  define	MLD_LISTENER_QUERY	130
60 # endif
61 # if !defined(MLD_LISTENER_REPORT)
62 #  define	MLD_LISTENER_REPORT	131
63 # endif
64 # if !defined(MLD_LISTENER_DONE)
65 #  define	MLD_LISTENER_DONE	132
66 # endif
67 # if defined(MLD_LISTENER_REDUCTION) && !defined(MLD_LISTENER_DONE)
68 #  define	MLD_LISTENER_DONE	MLD_LISTENER_REDUCTION
69 # endif
70 #endif
71 
72 icmptype_t icmptypelist[] = {
73 	{ "echo",	ICMP_ECHO,		ICMP6_ECHO_REQUEST },
74 	{ "echorep",	ICMP_ECHOREPLY,		ICMP6_ECHO_REPLY },
75 	{ "fqdnquery",	-1,			ICMP6_FQDN_QUERY },
76 	{ "fqdnreply",	-1,			ICMP6_FQDN_REPLY },
77 	{ "infoqry",	-1,			ICMP6_NI_QUERY },
78 	{ "inforeq",	ICMP_IREQ,		ICMP6_NI_QUERY },
79 	{ "inforep",	ICMP_IREQREPLY,		ICMP6_NI_REPLY },
80 	{ "listendone",	-1,			MLD_LISTENER_DONE },
81 	{ "listenqry",	-1,			MLD_LISTENER_QUERY },
82 	{ "listenrep",	-1,			MLD_LISTENER_REPORT },
83 	{ "maskrep",	ICMP_MASKREPLY,		-1 },
84 	{ "maskreq",	ICMP_MASKREQ,		-1 },
85 	{ "memberqry",	-1,			ICMP6_MEMBERSHIP_QUERY },
86 	{ "memberred",	-1,			ICMP6_MEMBERSHIP_REDUCTION },
87 	{ "memberreply",-1,			ICMP6_MEMBERSHIP_REPORT },
88 	{ "neighadvert",	-1,		ND_NEIGHBOR_ADVERT },
89 	{ "neighborsol",	-1,		ND_NEIGHBOR_SOLICIT },
90 	{ "neighborsolicit",	-1,		ND_NEIGHBOR_SOLICIT },
91 	{ "paramprob",	ICMP_PARAMPROB,		ICMP6_PARAM_PROB },
92 	{ "redir",	ICMP_REDIRECT,		ND_REDIRECT },
93 	{ "renumber",	-1,			ICMP6_ROUTER_RENUMBERING },
94 	{ "routerad",	ICMP_ROUTERADVERT,	ND_ROUTER_ADVERT },
95 	{ "routeradvert",ICMP_ROUTERADVERT,	ND_ROUTER_ADVERT },
96 	{ "routersol",	ICMP_ROUTERSOLICIT,	ND_ROUTER_SOLICIT },
97 	{ "routersolcit",ICMP_ROUTERSOLICIT,	ND_ROUTER_SOLICIT },
98 	{ "squench",	ICMP_SOURCEQUENCH,	-1 },
99 	{ "timest",	ICMP_TSTAMP,		-1 },
100 	{ "timestrep",	ICMP_TSTAMPREPLY,	-1 },
101 	{ "timex",	ICMP_TIMXCEED,		ICMP6_TIME_EXCEEDED },
102 	{ "toobig",	-1,			ICMP6_PACKET_TOO_BIG },
103 	{ "unreach",	ICMP_UNREACH,		ICMP6_DST_UNREACH },
104 	{ "whorep",	-1,			ICMP6_WRUREPLY },
105 	{ "whoreq",	-1,			ICMP6_WRUREQUEST },
106 	{ NULL,		-1,			-1 }
107 };
108