From: Pete Zaitcev <zaitcev@redhat.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: Project Hail List <hail-devel@vger.kernel.org>
Subject: [Patch 3/3] tabled: drop addr_af
Date: Tue, 15 Dec 2009 22:10:17 -0700 [thread overview]
Message-ID: <20091215221017.4cffc964@redhat.com> (raw)
This flag was is a useless duplication and a fiction prompted by
getaddrinfo(). In reality it's not useful even if we decide to run
CLD over DCCP.
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
---
server/storage.c | 8 ++++----
server/tabled.h | 3 +--
2 files changed, 5 insertions(+), 6 deletions(-)
commit 7b1efec72048557b1b51d07a95073dbe25cf08d1
Author: Master <zaitcev@lembas.zaitcev.lan>
Date: Tue Dec 15 21:47:48 2009 -0700
Drop af flag, not needed.
diff --git a/server/storage.c b/server/storage.c
index cc7066f..8298e60 100644
--- a/server/storage.c
+++ b/server/storage.c
@@ -44,10 +44,10 @@ static int stor_new_stc(struct storage_node *stn, struct st_client **stcp)
struct sockaddr_in6 *a6;
unsigned short port;
- if (stn->addr_af == AF_INET) {
+ if (stn->addr.sin6_family == AF_INET) {
a4 = (struct sockaddr_in *) &stn->addr;
port = ntohs(a4->sin_port);
- } else if (stn->addr_af == AF_INET6) {
+ } else if (stn->addr.sin6_family == AF_INET6) {
a6 = &stn->addr;
port = ntohs(a6->sin6_port);
} else {
@@ -419,9 +419,9 @@ static int stor_add_node_addr(struct storage_node *sn,
if (res->ai_addrlen > ADDRSIZE) /* should not happen */
continue;
- memcpy(&sn->addr, res->ai_addr, res->ai_addrlen);
- sn->addr_af = res->ai_family;
sn->alen = res->ai_addrlen;
+ memcpy(&sn->addr, res->ai_addr, sn->alen);
+ sn->addr.sin6_family = res->ai_family;
/* Use just the first address for now. */
freeaddrinfo(res0);
diff --git a/server/tabled.h b/server/tabled.h
index 51bfd44..290edaf 100644
--- a/server/tabled.h
+++ b/server/tabled.h
@@ -36,7 +36,7 @@
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
#endif
-#define ADDRSIZE 24 /* Enough for IPv6, including port. */
+#define ADDRSIZE (sizeof(struct sockaddr_in6)) /* enough for v4 & v6 */
enum {
TABLED_PGSZ_INODE = 4096,
@@ -96,7 +96,6 @@ struct storage_node {
time_t last_up;
unsigned alen;
- int addr_af;
struct sockaddr_in6 addr;
char *hostname; /* Only used because stc_new is overly smart. */
next reply other threads:[~2009-12-16 5:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-16 5:10 Pete Zaitcev [this message]
2009-12-16 5:48 ` [Patch 3/3] tabled: drop addr_af Jeff Garzik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091215221017.4cffc964@redhat.com \
--to=zaitcev@redhat.com \
--cc=hail-devel@vger.kernel.org \
--cc=jeff@garzik.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.