add better fix for big endian issue on s390x/ppc64
This commit is contained in:
parent
7a4705c012
commit
a25f285c78
@ -1,42 +1,16 @@
|
||||
diff -up ModemManager-1.5.991/plugins/huawei/tests/test-modem-helpers-huawei.c.than ModemManager-1.5.991/plugins/huawei/tests/test-modem-helpers-huawei.c
|
||||
--- ModemManager-1.5.991/plugins/huawei/tests/test-modem-helpers-huawei.c.than 2016-04-07 08:04:47.226567436 -0400
|
||||
+++ ModemManager-1.5.991/plugins/huawei/tests/test-modem-helpers-huawei.c 2016-04-07 10:45:48.832853814 -0400
|
||||
@@ -161,6 +161,22 @@ static const DhcpTest dhcp_tests[] = {
|
||||
{ NULL }
|
||||
};
|
||||
diff -up ModemManager-1.5.991/plugins/huawei/mm-modem-helpers-huawei.c.than ModemManager-1.5.991/plugins/huawei/mm-modem-helpers-huawei.c
|
||||
--- ModemManager-1.5.991/plugins/huawei/mm-modem-helpers-huawei.c.than 2016-04-12 14:03:15.519328232 +0200
|
||||
+++ ModemManager-1.5.991/plugins/huawei/mm-modem-helpers-huawei.c 2016-04-12 13:56:58.978491128 +0200
|
||||
@@ -190,7 +190,11 @@ match_info_to_ip4_addr (GMatchInfo *matc
|
||||
if (!bin || bin_len != 4)
|
||||
goto done;
|
||||
|
||||
+static char * checkendian(char *ip)
|
||||
+{
|
||||
- *out_addr = GUINT32_TO_BE (*((guint32 *) bin));
|
||||
+#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
+ in_addr_t addr;
|
||||
+ inet_pton(AF_INET, ip, &addr);
|
||||
+ addr =
|
||||
+ ((addr & 0xff000000) >> 24) |
|
||||
+ ((addr & 0x00ff0000) >> 8) |
|
||||
+ ((addr & 0x0000ff00) << 8) |
|
||||
+ ((addr & 0x000000ff) << 24);
|
||||
+
|
||||
+ inet_ntop(AF_INET, &addr, ip, INET_ADDRSTRLEN);
|
||||
+ *out_addr = GUINT32_TO_LE (*((guint32 *) bin));
|
||||
+#else
|
||||
+ *out_addr = GUINT32_TO_BE (*((guint32 *) bin));
|
||||
+#endif
|
||||
+ return ip;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
test_dhcp (void)
|
||||
{
|
||||
@@ -180,11 +196,11 @@ test_dhcp (void)
|
||||
&error) == TRUE);
|
||||
g_assert_no_error (error);
|
||||
|
||||
- g_assert_cmpstr (inet_ntoa (*((struct in_addr *) &addr)), ==, dhcp_tests[i].expected_addr);
|
||||
+ g_assert_cmpstr (checkendian(inet_ntoa (*((struct in_addr *) &addr))), ==, dhcp_tests[i].expected_addr);
|
||||
g_assert_cmpint (prefix, ==, dhcp_tests[i].expected_prefix);
|
||||
- g_assert_cmpstr (inet_ntoa (*((struct in_addr *) &gateway)), ==, dhcp_tests[i].expected_gateway);
|
||||
- g_assert_cmpstr (inet_ntoa (*((struct in_addr *) &dns1)), ==, dhcp_tests[i].expected_dns1);
|
||||
- g_assert_cmpstr (inet_ntoa (*((struct in_addr *) &dns2)), ==, dhcp_tests[i].expected_dns2);
|
||||
+ g_assert_cmpstr (checkendian(inet_ntoa (*((struct in_addr *) &gateway))), ==, dhcp_tests[i].expected_gateway);
|
||||
+ g_assert_cmpstr (checkendian(inet_ntoa (*((struct in_addr *) &dns1))), ==, dhcp_tests[i].expected_dns1);
|
||||
+ g_assert_cmpstr (checkendian(inet_ntoa (*((struct in_addr *) &dns2))), ==, dhcp_tests[i].expected_dns2);
|
||||
}
|
||||
}
|
||||
success = TRUE;
|
||||
|
||||
done:
|
||||
|
@ -7,7 +7,7 @@
|
||||
Summary: Mobile broadband modem management service
|
||||
Name: ModemManager
|
||||
Version: 1.6
|
||||
Release: 0.2.rc2%{?dist}
|
||||
Release: 0.3.rc2%{?dist}
|
||||
#
|
||||
# Source from http://freedesktop.org/software/ModemManager/
|
||||
#
|
||||
@ -173,6 +173,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
|
||||
%{_datadir}/vala/vapi/libmm-glib.*
|
||||
|
||||
%changelog
|
||||
* Tue Apr 12 2016 Than Ngo <than@redhat.com> - 1.6-0.3.rc2
|
||||
- add better fix for big endian issue on s390x/ppc64
|
||||
|
||||
* Thu Apr 07 2016 Than Ngo <than@redhat.com> - 1.6-0.2.rc2
|
||||
- fix big endian issue on s390x/ppc64
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user