Discussion:
expanding netinet/icmp6.h with strings (et al)
(too old to reply)
S.P.Zeidler
2012-07-18 16:49:40 UTC
Permalink
Hi,

the following patch:
- adds a define for MLDV2_LISTENER_REPORT from FreeBSD (the name is as
good as any and if it's there, the names won't grow apart as easily)
- adds defines for the missing ICMP6_DST_UNREACH codes
- adds strings for the types and codes (encapsulated by ICMP6_STRINGS)

Comments? Cries of pain? Shedding of bikes? ;)

-------------------------------------------------------------------------
Index: sys/netinet/icmp6.h
===================================================================
RCS file: /cvsroot/src/sys/netinet/icmp6.h,v
retrieving revision 1.44
diff -u -r1.44 icmp6.h
--- sys/netinet/icmp6.h 10 Dec 2011 19:14:29 -0000 1.44
+++ sys/netinet/icmp6.h 18 Jul 2012 12:23:37 -0000
@@ -125,6 +125,7 @@
#define ICMP6_FQDN_REPLY 140 /* FQDN reply */
#define ICMP6_NI_QUERY 139 /* node information request */
#define ICMP6_NI_REPLY 140 /* node information reply */
+#define MLDV2_LISTENER_REPORT 143 /* RFC3810 listener report */

/* The definitions below are experimental. TBA */
#define MLD_MTRACE_RESP 200 /* mtrace response(to sender) */
@@ -144,6 +145,9 @@
#define ICMP6_DST_UNREACH_BEYONDSCOPE 2 /* beyond scope of source address */
#define ICMP6_DST_UNREACH_ADDR 3 /* address unreachable */
#define ICMP6_DST_UNREACH_NOPORT 4 /* port unreachable */
+#define ICMP6_DST_UNREACH_POLICY 5 /* source address failed ingress/egress policy */
+#define ICMP6_DST_UNREACH_REJROUTE 6 /* reject route to destination */
+#define ICMP6_DST_UNREACH_SOURCERT 7 /* error in source routing header */

#define ICMP6_TIME_EXCEED_TRANSIT 0 /* ttl==0 in transit */
#define ICMP6_TIME_EXCEED_REASSEMBLY 1 /* ttl==0 in reass */
@@ -733,4 +737,41 @@
extern int icmp6_redirtimeout; /* cache time for redirect routes */
#endif /* _KERNEL */

+#ifdef ICMP6_STRINGS
+/* Info: http://www.iana.org/assignments/icmpv6-parameters */
+
+static const char *icmp6_type_err[] = {
+ "reserved0", "unreach", "packet_too_big", "timxceed", "paramprob",
+ NULL
+};
+
+static const char *icmp6_type_info[] = {
+ "echo", "echoreply",
+ "mcastlistenq", "mcastlistenrep", "mcastlistendone",
+ "rtsol", "rtadv", "neighsol", "neighadv", "redirect",
+ "routerrenum", "nodeinfoq", "nodeinfor", "invneighsol", "invneighrep",
+ "mcastlistenrep2", "haad_req", "haad_rep",
+ "mobile_psol", "mobile_padv", "cga_sol", "cga_adv",
+ "experimental150", "mcast_rtadv", "mcast_rtsol", "mcast_rtterm",
+ "fmipv6_msg", "rpl_control", NULL
+};
+
+static const char *icmp6_code_none[] = { "none", NULL };
+
+static const char *icmp6_code_unreach[] = {
+ "noroute", "admin", "beyondscope", "addr", "port",
+ "srcaddr_policy", "reject_route", "source_route_err", NULL
+};
+
+static const char *icmp6_code_timxceed[] = {
+ "intrans", "reass", NULL
+};
+
+static const char *icmp6_code_paramprob[] = {
+ "hdr_field", "nxthdr_type", "option", NULL
+};
+
+/* not all informational icmps that have codes have a names array */
+#endif
+
#endif /* !_NETINET_ICMP6_H_ */
-------------------------------------------------------------------------

regards,
spz
--
***@serpens.de (S.P.Zeidler)

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Matthew Mondor
2012-07-18 18:11:31 UTC
Permalink
On Wed, 18 Jul 2012 18:49:40 +0200
Post by S.P.Zeidler
Comments? Cries of pain? Shedding of bikes? ;)
Is there an interface to obtain strings from the codes, or using those
strings? I.e. should those strings not be in a .c module along with an
API to query them similar to strerror(3)?

I'm not familiar with RFC3810 though, so I might not understand the
context. Don't consider this a cry of pain or a bike shedding :)

Thanks,
--
Matt

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Christos Zoulas
2012-07-18 20:38:17 UTC
Permalink
Post by S.P.Zeidler
Hi,
- adds a define for MLDV2_LISTENER_REPORT from FreeBSD (the name is as
good as any and if it's there, the names won't grow apart as easily)
- adds defines for the missing ICMP6_DST_UNREACH codes
- adds strings for the types and codes (encapsulated by ICMP6_STRINGS)
Comments? Cries of pain? Shedding of bikes? ;)
go for it.

christos


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Loading...