Improved solaris compatibility
diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index a9d7e4f..0728261 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -328,9 +328,10 @@
}
/* DNS1 and DNS2 */
+#ifndef HAVE_INET_ATON
dns1.s_addr = 0;
if (args_info.pcodns1_arg) {
- if (0 >= inet_pton(AF_INET, args_info.pcodns1_arg, &dns1)) {
+ if (0 == inet_aton(args_info.pcodns1_arg, &dns1)) {
sys_err(LOG_ERR, __FILE__, __LINE__, 0,
"Failed to convert pcodns1!");
exit(1);
@@ -338,12 +339,37 @@
}
dns2.s_addr = 0;
if (args_info.pcodns2_arg) {
- if (0 >= inet_pton(AF_INET, args_info.pcodns2_arg, &dns2)) {
+ if (0 == inet_aton(args_info.pcodns2_arg, &dns2)) {
sys_err(LOG_ERR, __FILE__, __LINE__, 0,
"Failed to convert pcodns2!");
exit(1);
}
}
+#else
+#ifndef HAVE_INET_ADDR
+ dns1.s_addr = 0;
+ if (args_info.pcodns1_arg) {
+ dns1 = inet_addr(args_info.pcodns1_arg);
+ if (dns1.s_addr == INADDR_NONE) {
+ sys_err(LOG_ERR, __FILE__, __LINE__, 0,
+ "Failed to convert pcodns1!");
+ exit(1);
+ }
+ }
+ dns2.s_addr = 0;
+ if (args_info.pcodns2_arg) {
+ dns2 = inet_addr(args_info.pcodns2_arg);
+ if (dns2.s_addr == INADDR_NONE) {
+ sys_err(LOG_ERR, __FILE__, __LINE__, 0,
+ "Failed to convert pcodns2!");
+ exit(1);
+ }
+ }
+#else
+#error Function missing!
+#endif
+#endif
+
pco.l = 20;
pco.v[0] = 0x80; /* x0000yyy x=1, yyy=000: PPP */