pkgsrc/net/kdenetwork2/patches/patch-aa
skrll 6a6e040839 Be more careful when trying to get the local and destination IP addresses
and wait a bit more time on NetBSD for pppd to start.
2001-12-13 00:58:31 +00:00

49 lines
1.4 KiB
Text

$NetBSD: patch-aa,v 1.3 2001/12/13 00:58:31 skrll Exp $
--- kppp/pppstats.cpp.orig Sun Dec 2 09:48:05 2001
+++ kppp/pppstats.cpp
@@ -208,27 +208,29 @@
strcpy(ifr.ifr_name, unitName);
+ local_ip_address = "";
if (ioctl(s, SIOCGIFADDR, &ifr) < 0) {
- }
+ kdDebug(5002) << "Cannot get ip address" << endl;
+ } else {
+ sinp = (struct sockaddr_in*)&ifr.ifr_addr;
- sinp = (struct sockaddr_in*)&ifr.ifr_addr;
+ if(sinp->sin_addr.s_addr)
+ local_ip_address = inet_ntoa(sinp->sin_addr);
- if(sinp->sin_addr.s_addr)
- local_ip_address = inet_ntoa(sinp->sin_addr);
- else
- local_ip_address = "";
- kdDebug(5002) << "Local IP: " << local_ip_address << endl;
+ kdDebug(5002) << "Local IP: " << local_ip_address << endl;
+ }
- if (ioctl(s, SIOCGIFDSTADDR, &ifr) < 0)
- ;
+ remote_ip_address = "";
+ if (ioctl(s, SIOCGIFDSTADDR, &ifr) < 0) {
+ kdDebug(5002) << "Cannot get remote ip address" << endl;
+ } else {
+ sinp = (struct sockaddr_in*)&ifr.ifr_dstaddr;
- sinp = (struct sockaddr_in*)&ifr.ifr_dstaddr;
+ if(sinp->sin_addr.s_addr)
+ remote_ip_address = inet_ntoa(sinp->sin_addr);
- if(sinp->sin_addr.s_addr)
- remote_ip_address = inet_ntoa(sinp->sin_addr);
- else
- remote_ip_address = "";
- kdDebug(5002) << "Remote IP: " << remote_ip_address << endl;
+ kdDebug(5002) << "Remote IP: " << remote_ip_address << endl;
+ }
return true;