2017-08-11 00:31:25 +02:00
|
|
|
/****************************************************************************
|
2021-03-08 22:39:04 +01:00
|
|
|
* net/route/net_dumproute.c
|
2017-08-11 00:31:25 +02:00
|
|
|
*
|
2021-02-19 12:45:37 +01:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2017-08-11 00:31:25 +02:00
|
|
|
*
|
2021-02-19 12:45:37 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2017-08-11 00:31:25 +02:00
|
|
|
*
|
2021-02-19 12:45:37 +01:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2017-08-11 00:31:25 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
|
|
#include <debug.h>
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
|
|
|
|
#include "route/route.h"
|
|
|
|
|
|
|
|
#if defined(CONFIG_NET_ROUTE) && defined(CONFIG_DEBUG_NET_INFO)
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: net_ipv4_dumproute and net_ipv6_dumproute
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Dump a routing table entry
|
|
|
|
*
|
2018-03-13 16:52:27 +01:00
|
|
|
* Input Parameters:
|
2017-08-11 00:31:25 +02:00
|
|
|
* route - The entry to be dumped
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_IPv4
|
|
|
|
void net_ipv4_dumproute(FAR const char *msg,
|
|
|
|
FAR struct net_route_ipv4_s *route)
|
|
|
|
{
|
|
|
|
ninfo("%s:\n", msg);
|
|
|
|
ninfo(" target=%08lx netmask=%08lx router=%08lx\n",
|
2022-01-18 08:38:00 +01:00
|
|
|
HTONL(route->target), HTONL(route->netmask), HTONL(route->router));
|
2017-08-11 00:31:25 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_IPv6
|
|
|
|
void net_ipv6_dumproute(FAR const char *msg,
|
|
|
|
FAR struct net_route_ipv6_s *route)
|
|
|
|
{
|
|
|
|
ninfo("%s:\n", msg);
|
|
|
|
ninfo(" target: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
|
2022-01-18 08:38:00 +01:00
|
|
|
HTONS(route->target[0]), HTONS(route->target[1]),
|
|
|
|
HTONS(route->target[2]), HTONS(route->target[3]),
|
|
|
|
HTONS(route->target[4]), HTONS(route->target[5]),
|
|
|
|
HTONS(route->target[6]), HTONS(route->target[7]));
|
2017-08-11 00:31:25 +02:00
|
|
|
ninfo(" netmask: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
|
2022-01-18 08:38:00 +01:00
|
|
|
HTONS(route->netmask[0]), HTONS(route->netmask[1]),
|
|
|
|
HTONS(route->netmask[2]), HTONS(route->netmask[3]),
|
|
|
|
HTONS(route->netmask[4]), HTONS(route->netmask[5]),
|
|
|
|
HTONS(route->netmask[6]), HTONS(route->netmask[7]));
|
2017-08-11 00:31:25 +02:00
|
|
|
ninfo(" router: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
|
2022-01-18 08:38:00 +01:00
|
|
|
HTONS(route->router[0]), HTONS(route->router[1]),
|
|
|
|
HTONS(route->router[2]), HTONS(route->router[3]),
|
|
|
|
HTONS(route->router[4]), HTONS(route->router[5]),
|
|
|
|
HTONS(route->router[6]), HTONS(route->router[7]));
|
2017-08-11 00:31:25 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* CONFIG_NET_ROUTE && CONFIG_DEBUG_NET_INFO */
|