}
static const char *
-ip_proto_name(uint8_t ip_proto)
+ip_proto_name(uint16_t ip_proto)
{
static const char * ip_proto_names[] = {
"IP6HOPOPTS", /**< IP6 hop-by-hop options */
if (ip_proto < sizeof(ip_proto_names) / sizeof(ip_proto_names[0]))
return ip_proto_names[ip_proto];
switch (ip_proto) {
+#ifdef IPPROTO_PGM
case IPPROTO_PGM: /**< PGM */
return "PGM";
+#endif
case IPPROTO_SCTP: /**< Stream Control Transport Protocol */
return "SCTP";
+#ifdef IPPROTO_DIVERT
case IPPROTO_DIVERT: /**< divert pseudo-protocol */
return "DIVERT";
+#endif
case IPPROTO_RAW: /**< raw IP packet */
return "RAW";
default:
return "UNASSIGNED";
}
-static void
-ether_addr_to_hexa(const struct ether_addr *ea, char *buf)
-{
- sprintf(buf, "%02x:%02x:%02x:%02x:%02x:%02x",
- ea->addr_bytes[0],
- ea->addr_bytes[1],
- ea->addr_bytes[2],
- ea->addr_bytes[3],
- ea->addr_bytes[4],
- ea->addr_bytes[5]);
-}
-
static void
ipv4_addr_to_dot(uint32_t be_ipv4_addr, char *buf)
{
static void
ether_addr_dump(const char *what, const struct ether_addr *ea)
{
- char buf[18];
+ char buf[ETHER_ADDR_FMT_SIZE];
- ether_addr_to_hexa(ea, buf);
+ ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, ea);
if (what)
printf("%s", what);
printf("%s", buf);