[Olsr-cvs] olsrd-current/src/bsd net.c,1.41,1.42
Bernd Petrovitsch
(spam-protected)
Thu Nov 29 19:20:47 CET 2007
Update of /cvsroot/olsrd/olsrd-current/src/bsd
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8852/src/bsd
Modified Files:
net.c
Log Message:
* more fixes fro MacOSX
Index: net.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/bsd/net.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** net.c 29 Nov 2007 17:09:16 -0000 1.41
--- net.c 29 Nov 2007 18:20:45 -0000 1.42
***************
*** 98,102 ****
static int gateway;
! static int set_sysctl_int(char *name, int new)
{
int old;
--- 98,102 ----
static int gateway;
! static int set_sysctl_int(const char *name, int new)
{
int old;
***************
*** 155,168 ****
int enable_ip_forwarding(int version)
{
! const char *name = version == AF_INET
! ? "net.inet.ip.forwarding"
! : "net.inet6.ip6.forwarding";
gateway = set_sysctl_int(name, 1);
! if (gateway < 0)
! {
! fprintf(stderr, "Cannot enable IP forwarding. Please enable IP forwarding manually. Continuing in 3 seconds...\n");
! sleep(3);
! }
return 1;
--- 155,165 ----
int enable_ip_forwarding(int version)
{
! const char *name = version == AF_INET ? "net.inet.ip.forwarding" : "net.inet6.ip6.forwarding";
gateway = set_sysctl_int(name, 1);
! if (gateway < 0) {
! fprintf(stderr, "Cannot enable IP forwarding. Please enable IP forwarding manually. Continuing in 3 seconds...\n");
! sleep(3);
! }
return 1;
***************
*** 226,230 ****
}
! int disable_redirects(const char *if_name, struct interface *iface, int version)
{
// this function gets called for each interface olsrd uses; however,
--- 223,227 ----
}
! int disable_redirects(const char *if_name __attribute__((unused)), struct interface *iface __attribute__((unused)), int version __attribute__((unused)))
{
// this function gets called for each interface olsrd uses; however,
***************
*** 235,239 ****
}
! int deactivate_spoof(const char *if_name, struct interface *iface, int version)
{
return 1;
--- 232,236 ----
}
! int deactivate_spoof(const char *if_name __attribute__((unused)), struct interface *iface __attribute__((unused)), int version __attribute__((unused)))
{
return 1;
***************
*** 242,253 ****
int restore_settings(int version)
{
- const char *name;
-
// reset IP forwarding
!
! if (version == AF_INET)
! name = "net.inet.ip.forwarding";
! else
! name = "net.inet6.ip6.forwarding";
set_sysctl_int(name, gateway);
--- 239,244 ----
int restore_settings(int version)
{
// reset IP forwarding
! const char *name = version == AF_INET ? "net.inet.ip.forwarding" : "net.inet6.ip6.forwarding";
set_sysctl_int(name, gateway);
***************
*** 256,287 ****
#ifdef __OpenBSD__
! if (version == AF_INET)
! name = "net.inet.icmp.rediraccept";
! else
! name = "net.inet6.icmp6.rediraccept";
!
#elif defined __FreeBSD__ || defined __MacOSX__
! if (version == AF_INET)
! name = "net.inet.icmp.drop_redirect";
! else
! name = "net.inet6.icmp6.rediraccept";
#else
! if (version == AF_INET)
! name = "net.inet.icmp.drop_redirect";
! else
! name = "net.inet6.icmp6.drop_redirect";
#endif
-
set_sysctl_int(name, ignore_redir);
// reset outgoing ICMP redirects
!
! if (version == AF_INET)
! name = "net.inet.ip.redirect";
! else
! name = "net.inet6.ip6.redirect";
!
set_sysctl_int(name, send_redir);
-
return 1;
}
--- 247,261 ----
#ifdef __OpenBSD__
! name = version == AF_INET ? "net.inet.icmp.rediraccept" : "net.inet6.icmp6.rediraccept";
#elif defined __FreeBSD__ || defined __MacOSX__
! name = version == AF_INET ? "net.inet.icmp.drop_redirect" : "net.inet6.icmp6.rediraccept";
#else
! name = version == AF_INET ? "net.inet.icmp.drop_redirect" : "net.inet6.icmp6.drop_redirect";
#endif
set_sysctl_int(name, ignore_redir);
// reset outgoing ICMP redirects
! name = version == AF_INET ? "net.inet.ip.redirect" : "net.inet6.ip6.redirect";
set_sysctl_int(name, send_redir);
return 1;
}
***************
*** 471,481 ****
{
/* See netinet6/in6.h */
!
struct ipv6_mreq mcastreq;
! mcastreq.ipv6mr_multiaddr=ifs->int6_multaddr.sin6_addr;
mcastreq.ipv6mr_interface = ifs->if_index;
! OLSR_PRINTF(3, "Interface %s joining multicast %s...", ifs->int_name, olsr_ip_to_string((union olsr_ip_addr *)&ifs->int6_multaddr.sin6_addr));
/* rfc 3493 */
--- 445,455 ----
{
/* See netinet6/in6.h */
! struct ipaddr_str addrstr;
struct ipv6_mreq mcastreq;
! mcastreq.ipv6mr_multiaddr = ifs->int6_multaddr.sin6_addr;
mcastreq.ipv6mr_interface = ifs->if_index;
! OLSR_PRINTF(3, "Interface %s joining multicast %s...", ifs->int_name, olsr_ip_to_string(&addrstr, (union olsr_ip_addr *)&ifs->int6_multaddr.sin6_addr));
/* rfc 3493 */
***************
*** 778,786 ****
sin6 = (struct sockaddr_in6 *)from;
OLSR_PRINTF (4, "%d bytes from %s, socket associated %s really received on %s\n",
! count,
! (olsr_cnf->ip_version == AF_INET6) ?
! inet_ntop(AF_INET6, (char *)&sin6->sin6_addr, addrstr,
! INET6_ADDRSTRLEN):
! inet_ntoa (sin->sin_addr),
ifc->int_name,
iname);
--- 752,757 ----
sin6 = (struct sockaddr_in6 *)from;
OLSR_PRINTF (4, "%d bytes from %s, socket associated %s really received on %s\n",
! count,
! inet_ntop(olsr_cnf->ip_version, olsr_cnf->ip_version == AF_INET6 ? (char *)&sin6->sin6_addr : (char *)&sin->sin_addr, addrstr, sizeof(addrstr)):
ifc->int_name,
iname);
More information about the Olsr-cvs
mailing list