default: abort();
}
}
+
/* Extract the address part from SA and store it in A. */
static void ipaddr_from_sockaddr(ipaddr *a, const struct sockaddr *sa)
{
#ifdef DEBUG
/* Write to standard error a description of the ACL node A. */
-static void dump_aclnode(aclnode *a)
+static void dump_aclnode(const aclnode *a)
{
char buf[ADDRBUFSZ];
const char *p;
fputc('\n', stderr);
}
-static void dump_acl(aclnode *a)
+static void dump_acl(const aclnode *a)
{
int act = ALLOW;
#endif
/* Returns nonzero if the ACL A allows the socket address SA. */
-static int acl_allows_p(aclnode *a, const struct sockaddr *sa)
+static int acl_allows_p(const aclnode *a, const struct sockaddr *sa)
{
unsigned short port = port_from_sockaddr(sa);
int act = ALLOW;
}
/* Decode the Unix address SUN to an Internet address SIN. If AF_HINT is
- * nonzero, an empty address (indicative of an unbound Unix-domain socket) of
- * the is translated to a wildcard Internet address of the appropriate
- * family. Returns zero on success; -1 on failure (e.g., it wasn't one of
- * our addresses).
+ * nonzero, an empty address (indicative of an unbound Unix-domain socket) is
+ * translated to a wildcard Internet address of the appropriate family.
+ * Returns zero on success; -1 on failure (e.g., it wasn't one of our
+ * addresses).
*/
static int decode_inet_addr(struct sockaddr *sa, int af_hint,
const struct sockaddr_un *sun,
}
SKIPSPC;
if (*p != ',') break;
- p++;
+ if (*p) p++;
}
+ *pp = p;
return;
bad:
if (*p != '-') goto bad; p++;
NEXTNUMBER(q, del); y = strtoul(q, 0, 0); RESCAN(del);
minautoport = x; maxautoport = y;
+ *pp = p;
return;
bad:
int socketpair(int pf, int ty, int proto, int *sk)
{
- if (pf == PF_INET) {
+ if (family_known_p(pf)) {
pf = PF_UNIX;
proto = 0;
}
{
struct sockaddr_un sun;
- if (to && to->sa_family == AF_INET) {
+ if (to && family_known_p(to->sa_family)) {
PRESERVING_ERRNO({
do_implicit_bind(sk, &to, &tolen, &sun);
});
const struct sockaddr *sa;
struct msghdr mymsg;
- if (msg->msg_name && SA(msg->msg_name)->sa_family == AF_INET) {
+ if (msg->msg_name && family_known_p(SA(msg->msg_name)->sa_family)) {
PRESERVING_ERRNO({
sa = SA(msg->msg_name);
mymsg = *msg;