summaryrefslogtreecommitdiffstatsabout
path: root/SylixOS
diff options
context:
space:
mode:
authorHanhui <hanhui@acoinfo.com>2020-06-29 11:49:21 (GMT)
committer Hanhui <hanhui@acoinfo.com>2020-06-29 11:49:21 (GMT)
commitcf4dd2a0fda4559030e32fa9786d298e8825bad0 (patch)
tree72a2d0ca5eb70727f896c2d9eea1a37607ac73de /SylixOS
parenta56d55b6c36bf6fddc70ac6515d3a667a656d37a (diff)
downloadlibsylixos-cf4dd2a0fda4559030e32fa9786d298e8825bad0.zip
libsylixos-cf4dd2a0fda4559030e32fa9786d298e8825bad0.tar.gz
libsylixos-cf4dd2a0fda4559030e32fa9786d298e8825bad0.tar.bz2
Fixed AF_ROUTE netlink type error.
Diffstat (limited to 'SylixOS')
-rw-r--r--SylixOS/net/lwip/lwip_iphook.c11
-rw-r--r--SylixOS/net/lwip/route/af_route.c11
-rw-r--r--SylixOS/net/lwip/route/ip4_route_x.c10
3 files changed, 6 insertions, 26 deletions
diff --git a/SylixOS/net/lwip/lwip_iphook.c b/SylixOS/net/lwip/lwip_iphook.c
index a884323..6af3a9c 100644
--- a/SylixOS/net/lwip/lwip_iphook.c
+++ b/SylixOS/net/lwip/lwip_iphook.c
@@ -476,16 +476,7 @@ int net_ip_hook_netif_get_name (struct netif *pnetif, char *name, size_t size)
int net_ip_hook_netif_get_type (struct netif *pnetif, int *type)
{
if (pnetif && type) {
- if ((pnetif->flags & NETIF_FLAG_BROADCAST) == 0) {
- *type = IFT_PPP;
- } else if (pnetif->flags & (NETIF_FLAG_ETHERNET | NETIF_FLAG_ETHARP)) {
- *type = IFT_ETHER;
- } else if (ip4_addr_isloopback(netif_ip4_addr(pnetif))) {
- *type = IFT_LOOP;
- } else {
- *type = IFT_OTHER;
- }
-
+ *type = pnetif->link_type;
return (ERROR_NONE);
}
diff --git a/SylixOS/net/lwip/route/af_route.c b/SylixOS/net/lwip/route/af_route.c
index 8468de2..5272af2 100644
--- a/SylixOS/net/lwip/route/af_route.c
+++ b/SylixOS/net/lwip/route/af_route.c
@@ -1434,20 +1434,15 @@ VOID route_hook_netif_updown (struct netif *pnetif)
pifdata = &pmsghdr->ifm_data;
lib_bzero(pifdata, sizeof(struct if_data));
+ pifdata->ifi_mtu = pnetif->mtu;
+ pifdata->ifi_type = pnetif->link_type;
+
if (pnetif->flags & NETIF_FLAG_ETHERNET) {
- pifdata->ifi_type = IFT_ETHER;
pifdata->ifi_addrlen = ETH_ALEN;
pifdata->ifi_hdrlen = ETH_HLEN;
- pifdata->ifi_mtu = ETH_DATA_LEN;
} else if (!(pnetif->flags & NETIF_FLAG_BROADCAST)) {
- pifdata->ifi_type = IFT_PPP;
- pifdata->ifi_addrlen = 0;
pifdata->ifi_hdrlen = 4;
- pifdata->ifi_mtu = 1500;
-
- } else {
- pifdata->ifi_type = IFT_OTHER;
}
pnetdev = (netdev_t *)(pnetif->state);
diff --git a/SylixOS/net/lwip/route/ip4_route_x.c b/SylixOS/net/lwip/route/ip4_route_x.c
index d443258..4c8d847 100644
--- a/SylixOS/net/lwip/route/ip4_route_x.c
+++ b/SylixOS/net/lwip/route/ip4_route_x.c
@@ -57,17 +57,11 @@ void rt_build_sockaddr_dl (struct sockaddr_dl *sdl, struct netif *netif)
sdl->sdl_family = AF_LINK;
sdl->sdl_index = netif_get_index(netif);
sdl->sdl_slen = 0;
-
+ sdl->sdl_type = netif->link_type;
+
if (netif->flags & NETIF_FLAG_ETHERNET) {
- sdl->sdl_type = IFT_ETHER;
sdl->sdl_alen = ETH_ALEN;
-
- } else if (!(netif->flags & NETIF_FLAG_BROADCAST)) {
- sdl->sdl_type = IFT_PPP;
- sdl->sdl_alen = 0;
-
} else {
- sdl->sdl_type = IFT_OTHER;
sdl->sdl_alen = 0;
}