Discussion:
config.w32.h is missing when compiling in win32
Shuhu Li ( mike )
2007-12-02 09:07:29 UTC
Permalink
Finally got this file, hope it helps to compile on win32,


/* Don't edit this file, edit config.w32.h instead */
#ifndef CONFIG_H
#define CONFIG_H

#define _WIN32_WINNT 0x0501
#include <winsock2.h>
#undef interface

#define BUNDLEEXT "obj"
#define HAVE_GOOD_VARGS

#define IFNAMSIZ 256 /* can be huge names on windows */
#define ETH_ALEN 6

#define HAVE_SP_H 1
#define HAVE_PCAP_H 1
#define HAVE_STDIO_H 1
#define HAVE_SOCKLEN_T 1
#define HAVE_ERRNO_H 1
#define HAVE_ASSERT_H 1

#define HAVE_INTXX_T 1
#define HAVE_U_INTXX_T 1
typedef __int8 int8_t;
typedef __int16 int16_t;
typedef __int32 int32_t;
typedef unsigned __int8 u_int_8_t;
typedef unsigned __int16 u_int_16_t;
typedef unsigned __int32 u_int_32_t;

/* pthread stubs */

#define DONT_USE_THREADS 1

#ifndef DONT_USE_THREADS
typedef DWORD pthread_t;
typedef CRITICAL_SECTION pthread_mutex_t;

typedef struct {
int detached;
} pthread_attr_t;

enum {
PTHREAD_CREATE_DETACHED = 1,

PTHREAD_CANCEL_DEFERRED = 0,
PTHREAD_CANCEL_ASYNCHRONOUS = 1,
};

int pthread_setcanceltype(int type, int *oldtype);
int pthread_cancel(pthread_t thread);

int pthread_create(pthread_t *thread, pthread_attr_t *attr,
void *(*start_routine)(void *), void *arg);
int pthread_attr_init(pthread_attr_t *attr);
int pthread_attr_setdetachstate(pthread_attr_t *attr, int state);
int pthread_attr_destroy(pthread_attr_t *attr);

int pthread_mutex_init(pthread_mutex_t *mutex, void *attr);
int pthread_mutex_lock(pthread_mutex_t *mutex);
int pthread_mutex_unlock(pthread_mutex_t *mutex);
int pthread_mutex_destroy(pthread_mutex_t *mutex);
#endif

/* fun with posix descriptors */

#define read _hide_ms_read
#define write _hide_ms_write
#define close _hide_ms_close
#include <io.h>
#undef read
#undef write
#undef close

int wackamole_win32_write(int fd, const void *buf, int len);
int wackamole_win32_read(int fd, void *buf, int len);
int wackamole_win32_close(int fd);

#define read wackamole_win32_read
#define write wackamole_win32_write
#define close wackamole_win32_close
#define EWOULDBLOCK EAGAIN

enum {
RTLD_GLOBAL,
RTLD_NOW
};

void *dlopen(const char *name, int flags);
void *dlsym(void *handle, const char *symbol);
void dlclose(void *handle);
const char *dlerror(void);

#include "defines.h"

#include <signal.h>

#endif
Spangler, Tim
2007-12-21 00:07:55 UTC
Permalink
All,

I've run into an interesting problem with Apache running several vhosts
and wackmole that I can't seem to work out in my head, thus I'm looking
for some advice from others that may have had a similar issue.

In my scenario, each Apache vhost needs its own IP address (they are all
running SSL, thus the IP), and Wackamole is used as a failover solution.
How do you configure Wackamole and Apache to handle multiple IP
addresses without ever losing requests?

Here are the scenarios I've thought of:

1) Set Apache to bind to 80 and 443 on all IPs. Works fine if you're
only using 1 vhost, but Apache cannot be configured in this manner for
multiple vhosts.

2) Set both Apache instances to bind to the VIP, and start wackamole on
the failover system, then start Apache on the failover, then start
wackamole on the primary (which moves the VIP to the primary), and
finally start Apache on the primary. Works, but is somewhat clunky, and
you cannot ever restart Apache on the failover system without killing
wackamole on the primary.

3) Round robin DNS between both systems with X VIPs, where X is twice
the number of virtual hosts I need. This works fine until one system
dies -- at that point the VIPs move to server 2, but Apache is not
listening on those IPs on server 2, so every other request fails.

Anyone have a clever idea to get this to work?

Thanks in advance,

-Tim Spangler









-----------------------------------------
This message and any attachments are intended only for the use of
the addressee and may contain information that is privileged and
confidential. If the reader of the message is not the intended
recipient or an authorized representative of the intended
recipient, you are hereby notified that any dissemination of this
communication is strictly prohibited. If you have received this
communication in error, notify the sender immediately by return
email and delete the message and any attachments from your system.
Rob Bloodgood
2007-12-21 19:10:57 UTC
Permalink
Post by Spangler, Tim
In my scenario, each Apache vhost needs its own IP address (they are all
running SSL, thus the IP), and Wackamole is used as a failover
solution. How do you configure Wackamole and Apache to handle multiple
IP addresses without ever losing requests?
1) Set Apache to bind to 80 and 443 on all IPs. Works fine if you're
only using 1 vhost, but Apache cannot be configured in this manner for
multiple vhosts.
2) Set both Apache instances to bind to the VIP, and start wackamole on
the failover system, then start Apache on the failover, then start
wackamole on the primary (which moves the VIP to the primary), and
finally start Apache on the primary. Works, but is somewhat clunky, and
you cannot ever restart Apache on the failover system without killing
wackamole on the primary.
3) Round robin DNS between both systems with X VIPs, where X is twice
the number of virtual hosts I need. This works fine until one system
dies -- at that point the VIPs move to server 2, but Apache is not
listening on those IPs on server 2, so every other request fails.
Anyone have a clever idea to get this to work?
Hi Tim! Here's how I did it (I'm using Apache 1.3.x):

For the NON ssl IPs, I have a vhosts.conf (it's Debian, but that's not
really important) that has:

NameVirtualHost *

# followed by several sections like
<VirtualHost *>
ServerName www.test.com
DocumentRoot /var/www/test.com
CustomLog /var/log/apache/test.com-access_log combined
ErrorLog /var/log/apache/test.com-error_log
<Directory /var/www/test.com>
AllowOverride All
</Directory>
</VirtualHost>

And all this works fine for non-SSL ips. The various web services get
wackamole virtual IPs in DNS, Apache answers on ANY AVAILABLE LOCAL IP
(which of course includes wackamole) and determines which website to
respond with based on HTTP/1.1. And failover is painless and seamless.

For SSL hosts, I have a file ssl_vhosts.conf. There are no
NameVirtualHost directives. Each ssl host gets <VirtualHost> a section
like so:

# the address here is the SSL hosts's IP,
# which should be a wackamole address.

<VirtualHost 111.222.333.444:443>

# General setup for the virtual host
DocumentRoot /var/www/test.com
ServerName www.test.com:443
ServerAdmin ***@test.com
ErrorLog /var/log/apache/test.com_ssl-error_log
TransferLog /var/log/apache/test.com_ssl-access_log

SSLCertificateFile /etc/apache/ssl.crt/test.com.crt
SSLCertificateKeyFile /etc/apache/ssl.key/test.com.key

SSLEngine on
SSLCipherSuite
ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL

<Files ~ "\.(cgi|shtml|phtml|php3?)$">
SSLOptions +StdEnvVars
</Files>
<Directory "/var/www/cgi-bin">
SSLOptions +StdEnvVars
</Directory>

SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0

#CustomLog logs/ssl_request_log \
# "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

</VirtualHost>


This makes my wackamole failover setup work perfectly. Now, I know your
question included "without ever losing any requests." Realistically, if
you lose requests for, say, 3 seconds when your source of income (the
websites) automatically fail over and resume functioning, instead of
just STOPPING because you just blew your power supply... well, I think
wackamole is a WONDERFUL solution. :-)

Hope this helps (and Merry Christmas)!


L8r,
Rob
Spangler, Tim
2007-12-28 17:47:20 UTC
Permalink
Thanks Rob, that solution worked great.

-Tim

-----Original Message-----
From: wackamole-users-***@lists.backhand.org
[mailto:wackamole-users-***@lists.backhand.org] On Behalf Of Rob
Bloodgood
Sent: Friday, December 21, 2007 12:11 PM
To: Wackamole Users List
Subject: Re: [Wackamole-users] Interesting logic problem with wackamole
andmultiple apache vhosts
Post by Spangler, Tim
In my scenario, each Apache vhost needs its own IP address (they are
all running SSL, thus the IP), and Wackamole is used as a failover
solution. How do you configure Wackamole and Apache to handle
multiple IP addresses without ever losing requests?
1) Set Apache to bind to 80 and 443 on all IPs. Works fine if you're
only using 1 vhost, but Apache cannot be configured in this manner for
multiple vhosts.
2) Set both Apache instances to bind to the VIP, and start wackamole
on the failover system, then start Apache on the failover, then start
wackamole on the primary (which moves the VIP to the primary), and
finally start Apache on the primary. Works, but is somewhat clunky,
and you cannot ever restart Apache on the failover system without
killing wackamole on the primary.
3) Round robin DNS between both systems with X VIPs, where X is twice
the number of virtual hosts I need. This works fine until one system
dies -- at that point the VIPs move to server 2, but Apache is not
listening on those IPs on server 2, so every other request fails.
Anyone have a clever idea to get this to work?
Hi Tim! Here's how I did it (I'm using Apache 1.3.x):

For the NON ssl IPs, I have a vhosts.conf (it's Debian, but that's not
really important) that has:

NameVirtualHost *

# followed by several sections like
<VirtualHost *>
ServerName www.test.com
DocumentRoot /var/www/test.com
CustomLog /var/log/apache/test.com-access_log combined
ErrorLog /var/log/apache/test.com-error_log
<Directory /var/www/test.com>
AllowOverride All
</Directory>
</VirtualHost>

And all this works fine for non-SSL ips. The various web services get
wackamole virtual IPs in DNS, Apache answers on ANY AVAILABLE LOCAL IP
(which of course includes wackamole) and determines which website to
respond with based on HTTP/1.1. And failover is painless and seamless.

For SSL hosts, I have a file ssl_vhosts.conf. There are no
NameVirtualHost directives. Each ssl host gets <VirtualHost> a section
like so:

# the address here is the SSL hosts's IP, # which should be a wackamole
address.

<VirtualHost 111.222.333.444:443>

# General setup for the virtual host
DocumentRoot /var/www/test.com
ServerName www.test.com:443
ServerAdmin ***@test.com
ErrorLog /var/log/apache/test.com_ssl-error_log
TransferLog /var/log/apache/test.com_ssl-access_log

SSLCertificateFile /etc/apache/ssl.crt/test.com.crt
SSLCertificateKeyFile /etc/apache/ssl.key/test.com.key

SSLEngine on
SSLCipherSuite
ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL

<Files ~ "\.(cgi|shtml|phtml|php3?)$">
SSLOptions +StdEnvVars
</Files>
<Directory "/var/www/cgi-bin">
SSLOptions +StdEnvVars
</Directory>

SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0

#CustomLog logs/ssl_request_log \
# "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

</VirtualHost>


This makes my wackamole failover setup work perfectly. Now, I know your
question included "without ever losing any requests." Realistically, if
you lose requests for, say, 3 seconds when your source of income (the
websites) automatically fail over and resume functioning, instead of
just STOPPING because you just blew your power supply... well, I think
wackamole is a WONDERFUL solution. :-)

Hope this helps (and Merry Christmas)!


L8r,
Rob
_______________________________________________
wackamole-users mailing list
wackamole-***@lists.backhand.org
http://lists.backhand.org/mailman/listinfo/wackamole-users

-----------------------------------------
This message and any attachments are intended only for the use of
the addressee and may contain information that is privileged and
confidential. If the reader of the message is not the intended
recipient or an authorized representative of the intended
recipient, you are hereby notified that any dissemination of this
communication is strictly prohibited. If you have received this
communication in error, notify the sender immediately by return
email and delete the message and any attachments from your system.
Loading...