From 41a35affc1be7234996275f4c3d6bf051c38eb0c Mon Sep 17 00:00:00 2001 From: jylefort Date: Wed, 3 May 2006 01:17:08 +0000 Subject: - Fix the GLIBTOP_IF_FLAGS_RUNNING and GLIBTOP_IF_FLAGS_OACTIVE flags. - Fix the mtu, subnet and address glibtop_netload members. - Fill in the hwaddress and address6 glibtop_netload members. --- devel/libgtop2/Makefile | 1 + .../libgtop2/files/patch-sysdeps_freebsd_netload.c | 92 ++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 devel/libgtop2/files/patch-sysdeps_freebsd_netload.c (limited to 'devel') diff --git a/devel/libgtop2/Makefile b/devel/libgtop2/Makefile index e8d7dcb40ee6..afa5c4877336 100644 --- a/devel/libgtop2/Makefile +++ b/devel/libgtop2/Makefile @@ -8,6 +8,7 @@ PORTNAME= libgtop2 PORTVERSION= 2.14.1 +PORTREVISION= 1 CATEGORIES= devel gnome MASTER_SITES= ${MASTER_SITE_GNOME} MASTER_SITE_SUBDIR= sources/${PORTNAME:S/2$//}/${PORTVERSION:C/^([0-9]+\.[0-9]+).*/\1/} diff --git a/devel/libgtop2/files/patch-sysdeps_freebsd_netload.c b/devel/libgtop2/files/patch-sysdeps_freebsd_netload.c new file mode 100644 index 000000000000..1ddd9697c9d8 --- /dev/null +++ b/devel/libgtop2/files/patch-sysdeps_freebsd_netload.c @@ -0,0 +1,92 @@ +--- sysdeps/freebsd/netload.c.orig Wed May 3 02:13:41 2006 ++++ sysdeps/freebsd/netload.c Wed May 3 02:37:57 2006 +@@ -28,6 +28,8 @@ + + #include + ++#include ++ + #include + #include + #include +@@ -83,7 +85,7 @@ + const char *interface) + { + struct ifnet ifnet; +- u_long ifnetaddr, ifnetfound, ifaddraddr; ++ u_long ifnetaddr, ifnetfound; + struct sockaddr *sa = NULL; + char tname [16]; + char name [32]; +@@ -101,12 +103,12 @@ + &ifnetaddr, sizeof (ifnetaddr)) != sizeof (ifnetaddr)) + glibtop_error_io_r (server, "kvm_read (ifnet)"); + +- ifaddraddr = 0; +- while (ifnetaddr || ifaddraddr) { ++ while (ifnetaddr) { + struct sockaddr_in *sin; + register char *cp; ++ u_long ifaddraddr; + +- if (ifaddraddr == 0) { ++ { + ifnetfound = ifnetaddr; + + if (kvm_read (server->machine.kd, ifnetaddr, &ifnet, +@@ -151,7 +153,7 @@ + buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_LOOPBACK); + if (ifnet.if_flags & IFF_POINTOPOINT) + buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_POINTOPOINT); +- if (ifnet.if_flags & IFF_RUNNING) ++ if (ifnet.if_drv_flags & IFF_DRV_RUNNING) + buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_RUNNING); + if (ifnet.if_flags & IFF_NOARP) + buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_NOARP); +@@ -159,7 +161,7 @@ + buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_PROMISC); + if (ifnet.if_flags & IFF_ALLMULTI) + buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_ALLMULTI); +- if (ifnet.if_flags & IFF_OACTIVE) ++ if (ifnet.if_drv_flags & IFF_DRV_OACTIVE) + buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_OACTIVE); + if (ifnet.if_flags & IFF_SIMPLEX) + buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_SIMPLEX); +@@ -191,7 +193,7 @@ + buf->collisions = ifnet.if_collisions; + buf->flags = _glibtop_sysdeps_netload; + +- if (ifaddraddr) { ++ while (ifaddraddr) { + if ((kvm_read (server->machine.kd, ifaddraddr, &ifaddr, + sizeof (ifaddr)) != sizeof (ifaddr))) + glibtop_error_io_r (server, "kvm_read (ifaddraddr)"); +@@ -201,7 +203,12 @@ + CP(&ifaddr); + sa = (struct sockaddr *)cp; + +- if (sa->sa_family == AF_INET) { ++ if (sa->sa_family == AF_LINK) { ++ struct sockaddr_dl *dl = (struct sockaddr_dl *) sa; ++ ++ memcpy (buf->hwaddress, LLADDR (dl), sizeof (buf->hwaddress)); ++ buf->flags |= GLIBTOP_NETLOAD_HWADDRESS; ++ } else if (sa->sa_family == AF_INET) { + sin = (struct sockaddr_in *)sa; + #if !defined(__bsdi__) + /* Commenting out to "fix" #13345. */ +@@ -211,8 +218,14 @@ + buf->mtu = ifnet.if_mtu; + + buf->flags |= _glibtop_sysdeps_netload_data; ++ } else if (sa->sa_family == AF_INET6) { ++ struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) sa; + ++ memcpy (buf->address6, &sin6->sin6_addr, sizeof (buf->address6)); ++ buf->flags |= GLIBTOP_NETLOAD_ADDRESS6; + } ++ /* FIXME prefix6, scope6 */ ++ ifaddraddr = (u_long) ifaddr.ifa.ifa_link.tqe_next; + } + return; + } -- cgit