#include <stdio.h>
#include <syslog.h>
+const u64 cliserv_magic = 0x00420281861253LL;
+const u64 opts_magic = 0x49484156454F5054LL;
+const u64 rep_magic = 0x3e889045565a9LL;
+
void setmysockopt(int sock) {
int size = 1;
#if 0
#endif
#endif
-static u64 cliserv_magic = 0x00420281861253LL;
-static u64 opts_magic = 0x49484156454F5054LL;
-static u64 rep_magic = 0x3e889045565a9LL;
+extern const u64 cliserv_magic;
+extern const u64 opts_magic;
+extern const u64 rep_magic;
+
#define INIT_PASSWD "NBDMAGIC"
#define INFO(a) do { } while(0)
**/
int set_peername(int net, CLIENT *client) {
struct sockaddr_storage netaddr;
- struct sockaddr_in *netaddr4 = NULL;
- struct sockaddr_in6 *netaddr6 = NULL;
socklen_t addrinlen = sizeof( struct sockaddr_storage );
struct addrinfo hints;
struct addrinfo *ai = NULL;
char *tmp = NULL;
int i;
int e;
- int shift;
if (getpeername(net, (struct sockaddr *) &(client->clientaddr), &addrinlen) < 0) {
msg(LOG_INFO, "getpeername failed: %m");
} else if(ai->ai_family == AF_INET6) {
addrbits = 128;
}
- uint8_t* addrptr = ((struct sockaddr*)&netaddr)->sa_data;
+ uint8_t* addrptr = (uint8_t*)(((struct sockaddr*)&netaddr)->sa_data);
for(int i = 0; i < addrbits; i+=8) {
int masklen = client->server->cidrlen - i;
masklen = masklen > 0 ? masklen : 0;
struct sock_flags;
int e;
int retval = -1;
- int i=0;
int sock = -1;
memset(&hints, '\0', sizeof(hints));
int authorized_client(CLIENT *opts) {
FILE *f ;
char line[LINELEN];
- char *tmp;
- struct in_addr addr;
- struct in_addr client;
- struct in_addr cltemp;
- int len;
if (opts->server->authname == NULL) {
msg(LOG_INFO, "No authorization file, granting access.");