diff options
author | Igor Pashev <igor.pashev@nexenta.com> | 2012-10-24 14:48:04 +0400 |
---|---|---|
committer | Igor Pashev <igor.pashev@nexenta.com> | 2012-10-24 14:48:04 +0400 |
commit | 98cb3b26f4043c9a83029c21855ff61b7601e611 (patch) | |
tree | e0e08eb9e6a168c65444dfc9751a522cb08b0ab3 /openpgm/patches | |
download | cibs-pkgs-98cb3b26f4043c9a83029c21855ff61b7601e611.tar.gz |
Initial commit from cibs/examples
Diffstat (limited to 'openpgm/patches')
-rw-r--r-- | openpgm/patches/000_ifr_netmask.patch | 15 | ||||
-rw-r--r-- | openpgm/patches/010_ifa_flags.patch | 107 |
2 files changed, 122 insertions, 0 deletions
diff --git a/openpgm/patches/000_ifr_netmask.patch b/openpgm/patches/000_ifr_netmask.patch new file mode 100644 index 0000000..20fc94e --- /dev/null +++ b/openpgm/patches/000_ifr_netmask.patch @@ -0,0 +1,15 @@ +Index: libpgm-5.1.118-1~dfsg/openpgm/pgm/configure.ac +=================================================================== +--- libpgm-5.1.118-1~dfsg.orig/openpgm/pgm/configure.ac 2011-09-27 17:59:08.000000000 +0000 ++++ libpgm-5.1.118-1~dfsg/openpgm/pgm/configure.ac 2012-06-06 20:21:04.407905323 +0000 +@@ -184,8 +184,8 @@ + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include <sys/types.h> + #include <ifaddrs.h>]], +- [[struct ifaddrs ifa; +-ifa.ifa_netmask = (struct sockaddr*)0;]])], ++ [[struct ifreq ifr; ++ifr.ifr_netmask = (struct sockaddr*)0;]])], + [AC_MSG_RESULT([yes]) + CFLAGS="$CFLAGS -DCONFIG_HAVE_IFR_NETMASK"], + [AC_MSG_RESULT([no])]) diff --git a/openpgm/patches/010_ifa_flags.patch b/openpgm/patches/010_ifa_flags.patch new file mode 100644 index 0000000..f362703 --- /dev/null +++ b/openpgm/patches/010_ifa_flags.patch @@ -0,0 +1,107 @@ +Descriptions: on illumos ifa_flags is uint64_t +Bug: http://code.google.com/p/openpgm/issues/detail?id=25 + +diff -dubr libpgm-5.1.118/openpgm/pgm/getifaddrs.c libpgm-5.1.118.flags/openpgm/pgm/getifaddrs.c +--- libpgm-5.1.118/openpgm/pgm/getifaddrs.c 2011-09-27 21:59:08.000000000 +0400 ++++ libpgm-5.1.118.flags/openpgm/pgm/getifaddrs.c 2012-09-24 05:25:16.404925472 +0400 +@@ -813,6 +813,68 @@ + return TRUE; + } + #endif /* _WIN32 */ ++#if defined( HAVE_GETIFADDRS ) ++static ++bool ++_pgm_getifaddrs ( ++ struct pgm_ifaddrs_t** restrict ifap, ++ pgm_error_t** restrict error ++ ) ++{ ++ struct ifaddrs *_ifap, *_ifa; ++ const int e = getifaddrs (&_ifap); ++ if (-1 == e) { ++ char errbuf[1024]; ++ pgm_set_error (error, ++ PGM_ERROR_DOMAIN_IF, ++ pgm_error_from_errno (errno), ++ _("getifaddrs failed: %s"), ++ pgm_strerror_s (errbuf, sizeof (errbuf), errno)); ++ return FALSE; ++ } ++ ++ int n = 0, k = 0; ++ for (_ifa = _ifap; _ifa; _ifa = _ifa->ifa_next) ++ ++n; ++ ++ struct _pgm_ifaddrs_t* ifa = pgm_new0 (struct _pgm_ifaddrs_t, n); ++ struct _pgm_ifaddrs_t* ift = ifa; ++ for (_ifa = _ifap; _ifa; _ifa = _ifa->ifa_next) ++ { ++/* ensure IP adapter */ ++ if (NULL == _ifa->ifa_addr || ++ (_ifa->ifa_addr->sa_family != AF_INET && ++ _ifa->ifa_addr->sa_family != AF_INET6) ) ++ { ++ continue; ++ } ++ ++/* address */ ++ ift->_ifa.ifa_addr = (void*)&ift->_addr; ++ memcpy (ift->_ifa.ifa_addr, _ifa->ifa_addr, pgm_sockaddr_len (_ifa->ifa_addr)); ++ ++/* name */ ++ ift->_ifa.ifa_name = ift->_name; ++ pgm_strncpy_s (ift->_ifa.ifa_name, IF_NAMESIZE, _ifa->ifa_name, _TRUNCATE); ++ ++/* flags */ ++ ift->_ifa.ifa_flags = _ifa->ifa_flags; ++ ++/* netmask */ ++ ift->_ifa.ifa_netmask = (void*)&ift->_netmask; ++ memcpy (ift->_ifa.ifa_netmask, _ifa->ifa_netmask, pgm_sockaddr_len (_ifa->ifa_netmask)); ++ ++/* next */ ++ if (k++ < (n - 1)) { ++ ift->_ifa.ifa_next = (struct pgm_ifaddrs_t*)(ift + 1); ++ ift = (struct _pgm_ifaddrs_t*)(ift->_ifa.ifa_next); ++ } ++ } ++ freeifaddrs (_ifap); ++ *ifap = (struct pgm_ifaddrs_t*)ifa; ++ return TRUE; ++} ++#endif /* HAVE_GETIFADDRS */ + + /* returns TRUE on success setting ifap to a linked list of system interfaces, + * returns FALSE on failure and sets error appropriately. +@@ -830,17 +892,7 @@ + (void*)ifap, (void*)error); + + #ifdef CONFIG_HAVE_GETIFADDRS +- const int e = getifaddrs ((struct ifaddrs**)ifap); +- if (-1 == e) { +- char errbuf[1024]; +- pgm_set_error (error, +- PGM_ERROR_DOMAIN_IF, +- pgm_error_from_errno (errno), +- _("getifaddrs failed: %s"), +- pgm_strerror_s (errbuf, sizeof (errbuf), errno)); +- return FALSE; +- } +- return TRUE; ++ return _pgm_getifaddrs (ifap, error); + #elif defined(CONFIG_TARGET_WINE) + return _pgm_getadaptersinfo (ifap, error); + #elif defined(_WIN32) +@@ -861,11 +913,7 @@ + { + pgm_return_if_fail (NULL != ifa); + +-#ifdef CONFIG_HAVE_GETIFADDRS +- freeifaddrs ((struct ifaddrs*)ifa); +-#else + pgm_free (ifa); +-#endif + } + + /* eof */ +Только в libpgm-5.1.118.flags/openpgm/pgm: getifaddrs.c.orig |