more like this:
<code>diff --git a/src/msg/msg_types.h b/src/msg/msg_types.h
index 40b3f0b..ed94b4f 100644
--- a/src/msg/msg_types.h
+++ b/src/msg/msg_types.h
@@ -158,23 +158,6 @@ namespace __gnu_cxx {
  * ipv4 for now.
  */
 
-/*
- * encode sockaddr.ss_family in big endian
- */
-static inline void encode(const sockaddr_storage& a, bufferlist& bl) {
-  struct sockaddr_storage ss = a;
-#if !defined(__FreeBSD__)
-  ss.ss_family = htons(ss.ss_family);
-#endif
-  ::encode_raw(ss, bl);
-}
-static inline void decode(sockaddr_storage& a, bufferlist::iterator& bl) {
-  ::decode_raw(a, bl);
-#if !defined(__FreeBSD__)
-  a.ss_family = ntohs(a.ss_family);
-#endif
-}
-
 struct entity_addr_t {
   __u32 type;
   __u32 nonce;
@@ -333,12 +316,21 @@ struct entity_addr_t {
   void encode(bufferlist& bl) const {
     ::encode(type, bl);
     ::encode(nonce, bl);
-    ::encode(addr, bl);
+
+#ifdef linux
+    ::encode(*(struct ceph_sockaddr_storage *)&ss, bl);
+#else
+    ceph_sockaddr_storage css;
+    css.foo = ss.foo;
+    ...
+    ::encode(css, bl);
+#endif
   }
   void decode(bufferlist::iterator& bl) {
     ::decode(type, bl);
     ::decode(nonce, bl);
-    ::decode(addr, bl);
+    //::decode(addr, bl);
+    do the same trickery here
   }
 
   void dump(Formatter *f) const;
</code>
killing the encode/decode methods for sockaddr_storage may catch other places in the code that do not use entity_addr_t. if there are several, we could also reintroduce a sockaddr_storage encode/decode taht captures the ugliness.

in fact now that i think about it this is much simpler:
<code>
diff --git a/src/msg/msg_types.h b/src/msg/msg_types.h
index 40b3f0b..6af7369 100644
--- a/src/msg/msg_types.h
+++ b/src/msg/msg_types.h
@@ -162,16 +162,21 @@ namespace __gnu_cxx {
  * encode sockaddr.ss_family in big endian
  */
 static inline void encode(const sockaddr_storage& a, bufferlist& bl) {
-  struct sockaddr_storage ss = a;
-#if !defined(__FreeBSD__)
-  ss.ss_family = htons(ss.ss_family);
+#if defined(__linux__)
+  ::encode_raw(*(ceph_sockaddr_storage*)&a, bl);
+#else
+  struct ceph_sockaddr_storage css;
+  sockaddr_storage_to_ceph_sockaddr_storage(&a, &css);
+  ::encode_raw(css, bl);
 #endif
-  ::encode_raw(ss, bl);
 }
 static inline void decode(sockaddr_storage& a, bufferlist::iterator& bl) {
-  ::decode_raw(a, bl);
-#if !defined(__FreeBSD__)
-  a.ss_family = ntohs(a.ss_family);
+#if defined(__linux__)
+  ::decode_raw(*(ceph_sockaddr_storage*)&a, bl);
+#else
+  struct ceph_sockaddr_storage css;
+  ::decode_raw(css, bl);
+  ceph_sockaddr_storage_to_sockaddr_storage(&css, &a);
 #endif
 }

</code>

hopefully that makes sense; i don't fully trust my jetlag-addled brain right now :)