/* This file has be substantially modified from the original OpenBSD source */
-/* $OpenBSD: bindresvport.c,v 1.16 2005/04/01 07:44:03 otto Exp $ */
+/* $OpenBSD: bindresvport.c,v 1.17 2005/12/21 01:40:22 millert Exp $ */
/*
* Copyright 1996, Jason Downs. All rights reserved.
#include "includes.h"
#ifndef HAVE_BINDRESVPORT_SA
+#include <sys/types.h>
+#include <sys/socket.h>
-#include "includes.h"
+#include <netinet/in.h>
+#include <arpa/inet.h>
#include <errno.h>
+#include <string.h>
#define STARTPORT 600
#define ENDPORT (IPPORT_RESERVED - 1)
{
int error, af;
struct sockaddr_storage myaddr;
- struct sockaddr_in *sin;
- struct sockaddr_in6 *sin6;
+ struct sockaddr_in *in;
+ struct sockaddr_in6 *in6;
u_int16_t *portp;
u_int16_t port;
socklen_t salen;
af = sa->sa_family;
if (af == AF_INET) {
- sin = (struct sockaddr_in *)sa;
+ in = (struct sockaddr_in *)sa;
salen = sizeof(struct sockaddr_in);
- portp = &sin->sin_port;
+ portp = &in->sin_port;
} else if (af == AF_INET6) {
- sin6 = (struct sockaddr_in6 *)sa;
+ in6 = (struct sockaddr_in6 *)sa;
salen = sizeof(struct sockaddr_in6);
- portp = &sin6->sin6_port;
+ portp = &in6->sin6_port;
} else {
errno = EPFNOSUPPORT;
return (-1);