From 9862ac0dbb72d8f5f9f894e567261e52354e0b15 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Mon, 5 Dec 2011 18:56:03 +0000 Subject: [PATCH] rx: Hide struct rx_peer from the rest of the tree The peer structure is an internal RX structure, so it shouldn't be contained in public header files, or used by non-rx modules. Hide the structure definition in rx_peer.h, and convert the rx_HostOf and rx_PortOf accessors from macros into functions. This will also help with adding support for non-IPv4 addresses to RX. Change-Id: I790fa3193bfa629a2872fc5395d0146e76a2de9e Reviewed-on: http://gerrit.openafs.org/7002 Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/bucoord/server.c | 2 +- src/kauth/admin_tools.c | 2 +- src/kauth/kaprocs.c | 16 +++---- src/libafs/Makefile.common.in | 4 ++ src/libafsrpc/Makefile.in | 4 ++ src/libafsrpc/NTMakefile | 2 +- src/libafsrpc/afsrpc.def | 2 + src/libuafs/Makefile.common.in | 13 ++++++ src/rx/Makefile.in | 5 ++- src/rx/NTMakefile | 2 +- src/rx/rx.c | 1 + src/rx/rx.h | 72 ++---------------------------- src/rx/rx_kcommon.c | 1 + src/rx/rx_packet.c | 1 + src/rx/rx_peer.c | 27 ++++++++++++ src/rx/rx_peer.h | 81 ++++++++++++++++++++++++++++++++++ src/rx/rx_user.c | 1 + src/shlibafsrpc/Makefile.in | 6 ++- src/shlibafsrpc/libafsrpc.map | 2 + src/viced/afsfileprocs.c | 4 +- 20 files changed, 162 insertions(+), 86 deletions(-) create mode 100644 src/rx/rx_peer.c create mode 100644 src/rx/rx_peer.h diff --git a/src/bucoord/server.c b/src/bucoord/server.c index aa2ebfd09..eeead8333 100644 --- a/src/bucoord/server.c +++ b/src/bucoord/server.c @@ -24,6 +24,6 @@ SBC_Print(struct rx_call *acall, afs_int32 acode, afs_int32 aflags, tconn = rx_ConnectionOf(acall); tpeer = rx_PeerOf(tconn); - printf("From %08x: %s <%d>\n", tpeer->host, amessage, acode); + printf("From %08x: %s <%d>\n", rx_HostOf(tpeer), amessage, acode); return 0; } diff --git a/src/kauth/admin_tools.c b/src/kauth/admin_tools.c index d286d50de..71b2b4c73 100644 --- a/src/kauth/admin_tools.c +++ b/src/kauth/admin_tools.c @@ -555,7 +555,7 @@ Unlock(struct cmd_syndesc *as, void *arock) server = 0; if (conn && conn->conns[count - 1] && rx_PeerOf(conn->conns[count - 1])) { - server = rx_PeerOf(conn->conns[count - 1])->host; + server = rx_HostOf(rx_PeerOf(conn->conns[count - 1])); } afs_com_err(whoami, code, "so %s.%s may still be locked (on server %d.%d.%d.%d)", diff --git a/src/kauth/kaprocs.c b/src/kauth/kaprocs.c index 71a834d12..7a937536b 100644 --- a/src/kauth/kaprocs.c +++ b/src/kauth/kaprocs.c @@ -648,7 +648,7 @@ kamCreateUser(struct rx_call *call, char *aname, char *ainstance, } code = ubik_EndTrans(tt); KALOG(aname, ainstance, NULL, NULL, NULL, - rx_PeerOf(rx_ConnectionOf(call))->host, LOG_CRUSER); + rx_HostOf(rx_PeerOf(rx_ConnectionOf(call))), LOG_CRUSER); return code; } @@ -924,7 +924,7 @@ kamSetPassword(struct rx_call *call, char *aname, char *ainstance, code = ubik_EndTrans(tt); KALOG(aname, ainstance, NULL, NULL, NULL, - rx_PeerOf(rx_ConnectionOf(call))->host, LOG_CHPASSWD); + rx_HostOf(rx_PeerOf(rx_ConnectionOf(call))), LOG_CHPASSWD); return code; abort: @@ -1247,14 +1247,14 @@ Authenticate(int version, struct rx_call *call, char *aname, char *ainstance, &user_schedule, ktc_to_cblockptr(&tentry.key), ENCRYPT); code = ubik_EndTrans(tt); KALOG(aname, ainstance, sname, sinst, NULL, - rx_PeerOf(rx_ConnectionOf(call))->host, LOG_AUTHENTICATE); + rx_HostOf(rx_PeerOf(rx_ConnectionOf(call))), LOG_AUTHENTICATE); return code; abort: COUNT_ABO; ubik_AbortTrans(tt); KALOG(aname, ainstance, sname, sinst, NULL, - rx_PeerOf(rx_ConnectionOf(call))->host, LOG_AUTHFAILED); + rx_HostOf(rx_PeerOf(rx_ConnectionOf(call))), LOG_AUTHFAILED); return code; } @@ -1456,7 +1456,7 @@ kamSetFields(struct rx_call *call, code = ubik_EndTrans(tt); KALOG(aname, ainstance, NULL, NULL, NULL, - rx_PeerOf(rx_ConnectionOf(call))->host, LOG_SETFIELDS); + rx_HostOf(rx_PeerOf(rx_ConnectionOf(call))), LOG_SETFIELDS); return code; abort: @@ -1529,7 +1529,7 @@ kamDeleteUser(struct rx_call *call, char *aname, char *ainstance) code = ubik_EndTrans(tt); KALOG(aname, ainstance, NULL, NULL, NULL, - rx_PeerOf(rx_ConnectionOf(call))->host, LOG_DELUSER); + rx_HostOf(rx_PeerOf(rx_ConnectionOf(call))), LOG_DELUSER); return code; } @@ -1932,7 +1932,7 @@ GetTicket(int version, &schedule, ktc_to_cblockptr(&authSessionKey), ENCRYPT); code = ubik_EndTrans(tt); KALOG(name, instance, sname, sinstance, (import ? authDomain : NULL), - rx_PeerOf(rx_ConnectionOf(call))->host, LOG_GETTICKET); + rx_HostOf(rx_PeerOf(rx_ConnectionOf(call))), LOG_GETTICKET); return code; abort: @@ -2259,7 +2259,7 @@ SKAM_Unlock(struct rx_call *call, code = ubik_EndTrans(tt); KALOG(aname, ainstance, NULL, NULL, NULL, - rx_PeerOf(rx_ConnectionOf(call))->host, LOG_UNLOCK); + rx_HostOf(rx_PeerOf(rx_ConnectionOf(call))), LOG_UNLOCK); goto exit; abort: diff --git a/src/libafs/Makefile.common.in b/src/libafs/Makefile.common.in index 346c70d47..d43c64c02 100644 --- a/src/libafs/Makefile.common.in +++ b/src/libafs/Makefile.common.in @@ -138,6 +138,7 @@ AFSAOBJS = \ rx.o \ rx_call.o \ rx_conn.o \ + rx_peer.o \ rx_rdwr.o \ rx_clock.o \ rx_event.o \ @@ -233,6 +234,7 @@ AFSPAGOBJS = \ rx.o \ rx_call.o \ rx_conn.o \ + rx_peer.o \ rx_rdwr.o \ rx_clock.o \ rx_event.o \ @@ -364,6 +366,8 @@ rx_call.o: $(TOP_SRC_RX)/rx_call.c $(CRULE_OPT) $(TOP_SRC_RX)/rx_call.c rx_conn.o: $(TOP_SRC_RX)/rx_conn.c $(CRULE_OPT) $(TOP_SRC_RX)/rx_conn.c +rx_peer.o: $(TOP_SRC_RX)/rx_peer.c + $(CRULE_OPT) $(TOP_SRC_RX)/rx_peer.c rx_rdwr.o: $(TOP_SRC_RX)/rx_rdwr.c $(CRULE_OPT) $(TOP_SRC_RX)/rx_rdwr.c afs_uuid.o: $(TOP_SRCDIR)/util/uuid.c diff --git a/src/libafsrpc/Makefile.in b/src/libafsrpc/Makefile.in index 67864f4f1..09ab4f876 100644 --- a/src/libafsrpc/Makefile.in +++ b/src/libafsrpc/Makefile.in @@ -65,6 +65,7 @@ RXOBJS =\ rx_opaque.o \ rx_call.o \ rx_conn.o \ + rx_peer.o \ rx_conncache.o \ rx_globals.o \ rx_identity.o \ @@ -143,6 +144,9 @@ rx.o: ${RX}/rx.c rx_conncache.o: ${RX}/rx_conncache.c $(AFS_CCRULE) $(RX)/rx_conncache.c +rx_peer.o: $(RX)/rx_peer.c + $(AFS_CCRULE) $(RX)/rx_peer.c + rx_conn.o: ${RX}/rx_conn.c $(AFS_CCRULE) $(RX)/rx_conn.c diff --git a/src/libafsrpc/NTMakefile b/src/libafsrpc/NTMakefile index fe48f8e2d..274d8238c 100644 --- a/src/libafsrpc/NTMakefile +++ b/src/libafsrpc/NTMakefile @@ -38,7 +38,7 @@ RXOBJS = $(OUT)\rx_event.obj $(OUT)\rx_user.obj $(OUT)\rx_pthread.obj \ $(OUT)\rx_packet.obj $(OUT)\rx_rdwr.obj $(OUT)\rx_trace.obj \ $(OUT)\rx_xmit_nt.obj $(OUT)\rx_conncache.obj $(OUT)\rx_opaque.obj \ $(OUT)\rx_identity.obj $(OUT)\rx_stats.obj \ - $(OUT)\rx_call.obj $(OUT)\rx_conn.obj + $(OUT)\rx_call.obj $(OUT)\rx_conn.obj $(OUT)\rx_peer.obj RXSTATBJS = $(OUT)\rxstat.obj $(OUT)\rxstat.ss.obj $(OUT)\rxstat.xdr.obj $(OUT)\rxstat.cs.obj diff --git a/src/libafsrpc/afsrpc.def b/src/libafsrpc/afsrpc.def index 5cc91439e..59ad355d8 100755 --- a/src/libafsrpc/afsrpc.def +++ b/src/libafsrpc/afsrpc.def @@ -328,6 +328,8 @@ EXPORTS rx_RecordCallStatistics @334 rx_KeepAliveOn @335 rx_KeepAliveOff @336 + rx_HostOf @337 + rx_PortOf @338 ; for performance testing rx_TSFPQGlobSize @2001 DATA diff --git a/src/libuafs/Makefile.common.in b/src/libuafs/Makefile.common.in index 2e4831ae1..796246845 100644 --- a/src/libuafs/Makefile.common.in +++ b/src/libuafs/Makefile.common.in @@ -203,6 +203,7 @@ UAFSOBJ = \ $(UOBJ)/rx_conncache.o \ $(UOBJ)/rx_call.o \ $(UOBJ)/rx_conn.o \ + $(UOBJ)/rx_peer.o \ $(UOBJ)/xdr_rx.o \ $(UOBJ)/Kvldbint.cs.o \ $(UOBJ)/Kvldbint.xdr.o \ @@ -350,6 +351,7 @@ PICUAFSOBJ = \ $(PICOBJ)/rx_conncache.o \ $(PICOBJ)/rx_call.o \ $(PICOBJ)/rx_conn.o \ + $(PICOBJ)/rx_peer.o \ $(PICOBJ)/xdr_rx.o \ $(PICOBJ)/Kvldbint.cs.o \ $(PICOBJ)/Kvldbint.xdr.o \ @@ -497,6 +499,7 @@ AFSWEBOBJ = \ $(WEBOBJ)/rx_conncache.o \ $(WEBOBJ)/rx_call.o \ $(WEBOBJ)/rx_conn.o \ + $(WEBOBJ)/rx_peer.o \ $(WEBOBJ)/xdr_rx.o \ $(WEBOBJ)/Kvldbint.cs.o \ $(WEBOBJ)/Kvldbint.xdr.o \ @@ -638,6 +641,7 @@ AFSWEBOBJKRB = \ $(WEBOBJ)/rx_conncache.o \ $(WEBOBJ)/rx_call.o \ $(WEBOBJ)/rx_conn.o \ + $(WEBOBJ)/rx_peer.o \ $(WEBOBJ)/xdr_rx.o \ $(WEBOBJ)/Kvldbint.cs.o \ $(WEBOBJ)/Kvldbint.xdr.o \ @@ -783,6 +787,7 @@ JUAFSOBJ = \ $(JUAFS)/rx_conncache.o \ $(JUAFS)/rx_call.o \ $(JUAFS)/rx_conn.o \ + $(JUAFS)/rx_peer.o \ $(JUAFS)/xdr_rx.o \ $(JUAFS)/Kvldbint.cs.o \ $(JUAFS)/Kvldbint.xdr.o \ @@ -988,6 +993,8 @@ $(UOBJ)/rx_call.o: $(TOP_SRCDIR)/rx/rx_call.c $(CRULE1) $(UOBJ)/rx_conn.o: $(TOP_SRCDIR)/rx/rx_conn.c $(CRULE1) +$(UOBJ)/rx_peer.o: $(TOP_SRCDIR)/rx/rx_peer.c + $(CRULE1) $(UOBJ)/xdr_rx.o: $(TOP_SRC_RX)/xdr_rx.c $(CRULE1) $(UOBJ)/xdr_int32.o: $(TOP_SRC_RX)/xdr_int32.c @@ -1289,6 +1296,8 @@ $(PICOBJ)/rx_call.o: $(TOP_SRCDIR)/rx/rx_call.c $(CRULEPIC) $(PICOBJ)/rx_conn.o: $(TOP_SRCDIR)/rx/rx_conn.c $(CRULEPIC) +$(PICOBJ)/rx_peer.o: $(TOP_SRCDIR)/rx/rx_peer.c + $(CRULEPIC) $(PICOBJ)/xdr_rx.o: $(TOP_SRC_RX)/xdr_rx.c $(CRULEPIC) $(PICOBJ)/xdr_int32.o: $(TOP_SRC_RX)/xdr_int32.c @@ -1592,6 +1601,8 @@ $(WEBOBJ)/rx_call.o: $(TOP_SRCDIR)/rx_rx_call.c $(CRULE2) $(WEBOBJ)/rx_conn.o: $(TOP_SRCDIR)/rx/rx_conn.c $(CRULE2) +$(WEBOBJ)/rx_peer.o: $(TOP_SRCDIR)/rx/rx_peer.c + $(CRULE2) $(WEBOBJ)/xdr_rx.o: $(TOP_SRC_RX)/xdr_rx.c $(CRULE2) $(WEBOBJ)/afs_usrops.o: $(TOP_SRC_AFS)/UKERNEL/afs_usrops.c @@ -1899,6 +1910,8 @@ $(JUAFS)/rx_call.o: $(TOP_SRC_RX)/rx_call.c $(CRULE1) $(JUAFS)/rx_conn.o: $(TOP_SRC_RX)/rx_conn.c $(CRULE1) +$(JUAFS)/rx_peer.o: $(TOP_SRC_RX)/rx_peer.c + $(CRULE1) $(JUAFS)/xdr_rx.o: $(TOP_SRC_RX)/xdr_rx.c $(CRULE1) $(JUAFS)/xdr_int64.o: $(TOP_SRC_RX)/xdr_int64.c diff --git a/src/rx/Makefile.in b/src/rx/Makefile.in index 8a2dc2257..63108ed5d 100644 --- a/src/rx/Makefile.in +++ b/src/rx/Makefile.in @@ -22,8 +22,9 @@ XDROBJS = xdr_arrayn.o ${XDROBJS_common} RXOBJS_common = rx_clock.o rx_call.o rx_conn.o rx_event.o rx_user.o rx_lwp.o \ rx.o rx_null.o rx_globals.o rx_getaddr.o rx_misc.o rx_packet.o \ - rx_rdwr.o rx_trace.o rx_conncache.o rx_opaque.o rx_identity.o \ - rx_stats.o xdr_int32.o xdr_int64.o xdr_update.o xdr_refernce.o + rx_peer.o rx_rdwr.o rx_trace.o rx_conncache.o rx_opaque.o \ + rx_identity.o rx_stats.o \ + xdr_int32.o xdr_int64.o xdr_update.o xdr_refernce.o RXOBJS = ${RXOBJS_common} diff --git a/src/rx/NTMakefile b/src/rx/NTMakefile index 7fa9959c1..b386e319a 100644 --- a/src/rx/NTMakefile +++ b/src/rx/NTMakefile @@ -36,7 +36,7 @@ RXOBJS = $(OUT)\rx_event.obj $(OUT)\rx_clock_nt.obj $(OUT)\rx_user.obj \ $(OUT)\rx_packet.obj $(OUT)\rx_rdwr.obj $(OUT)\rx_trace.obj \ $(OUT)\rx_xmit_nt.obj $(OUT)\rx_conncache.obj \ $(OUT)\rx_opaque.obj $(OUT)\rx_identity.obj $(OUT)\rx_stats.obj \ - $(OUT)\rx_call.obj $(OUT)\rx_conn.obj + $(OUT)\rx_call.obj $(OUT)\rx_conn.obj $(OUT)\rx_peer.obj MULTIOBJS = $(OUT)\rx_multi.obj diff --git a/src/rx/rx.c b/src/rx/rx.c index ee134bb21..f6aa9ff6f 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -80,6 +80,7 @@ extern afs_int32 afs_termState; #include "rx_stats.h" #include "rx_event.h" +#include "rx_peer.h" #include "rx_conn.h" #include "rx_call.h" #include "rx_packet.h" diff --git a/src/rx/rx.h b/src/rx/rx.h index 5ab0c46b8..45f40c78f 100644 --- a/src/rx/rx.h +++ b/src/rx/rx.h @@ -103,6 +103,9 @@ extern void rx_RecordCallStatistics(struct rx_call *call, unsigned int totalFunc, int isServer); +/* Peer management */ +extern afs_uint32 rx_HostOf(struct rx_peer *peer); +extern u_short rx_PortOf(struct rx_peer *peer); /* Packets */ @@ -205,8 +208,6 @@ int ntoh_syserr_conv(int error); #define RX_WAIT 1 #define RX_DONTWAIT 0 -#define rx_HostOf(peer) ((peer)->host) -#define rx_PortOf(peer) ((peer)->port) #define rx_GetLocalStatus(call, status) ((call)->localStatus) @@ -388,73 +389,6 @@ struct rx_serverQueueEntry { osi_socket *socketp; }; - -/* A peer refers to a peer process, specified by a (host,port) pair. There may be more than one peer on a given host. */ -#ifdef KDUMP_RX_LOCK -struct rx_peer_rx_lock { - struct rx_peer_rx_lock *next; /* Next in hash conflict or free list */ -#else -struct rx_peer { - struct rx_peer *next; /* Next in hash conflict or free list */ -#endif -#ifdef RX_ENABLE_LOCKS - afs_kmutex_t peer_lock; /* Lock peer */ -#endif /* RX_ENABLE_LOCKS */ - afs_uint32 host; /* Remote IP address, in net byte order */ - u_short port; /* Remote UDP port, in net byte order */ - - /* interface mtu probably used for this host - includes RX Header */ - u_short ifMTU; /* doesn't include IP header */ - - /* For garbage collection */ - afs_uint32 idleWhen; /* When the refcountwent to zero */ - afs_int32 refCount; /* Reference count for this structure (rx_peerHashTable_lock) */ - - /* Congestion control parameters */ - u_char burstSize; /* Reinitialization size for the burst parameter */ - u_char burst; /* Number of packets that can be transmitted right now, without pausing */ - struct clock burstWait; /* Delay until new burst is allowed */ - struct rx_queue congestionQueue; /* Calls that are waiting for non-zero burst value */ - int rtt; /* Smoothed round trip time, measured in milliseconds/8 */ - int rtt_dev; /* Smoothed rtt mean difference, in milliseconds/4 */ - int nSent; /* Total number of distinct data packets sent, not including retransmissions */ - int reSends; /* Total number of retransmissions for this peer, since this structure was created */ - -/* Skew: if a packet is received N packets later than expected (based - * on packet serial numbers), then we define it to have a skew of N. - * The maximum skew values allow us to decide when a packet hasn't - * been received yet because it is out-of-order, as opposed to when it - * is likely to have been dropped. */ - afs_uint32 inPacketSkew; /* Maximum skew on incoming packets */ - afs_uint32 outPacketSkew; /* Peer-reported max skew on our sent packets */ - - /* the "natural" MTU, excluding IP,UDP headers, is negotiated by the endpoints */ - u_short natMTU; - u_short maxMTU; - /* negotiated maximum number of packets to send in a single datagram. */ - u_short maxDgramPackets; - /* local maximum number of packets to send in a single datagram. */ - u_short ifDgramPackets; - /* - * MTU, cwind, and nDgramPackets are used to initialize - * slow start parameters for new calls. These values are set whenever a - * call sends a retransmission and at the end of each call. - * congestSeq is incremented each time the congestion parameters are - * changed by a call recovering from a dropped packet. A call used - * MAX when updating congestion parameters if it started with the - * current congestion sequence number, otherwise it uses MIN. - */ - u_short MTU; /* MTU for AFS 3.4a jumboGrams */ - u_short cwind; /* congestion window */ - u_short nDgramPackets; /* number packets per AFS 3.5 jumbogram */ - u_short congestSeq; /* Changed when a call retransmits */ - afs_hyper_t bytesSent; /* Number of bytes sent to this peer */ - afs_hyper_t bytesReceived; /* Number of bytes received from this peer */ - struct rx_queue rpcStats; /* rpc statistic list */ - int lastReachTime; /* Last time we verified reachability */ - afs_int32 maxPacketSize; /* peer packetsize hint */ -}; - #ifndef KDUMP_RX_LOCK /* Flag bits for connection structure */ #define RX_CONN_MAKECALL_WAITING 1 /* rx_NewCall is waiting for a channel */ diff --git a/src/rx/rx_kcommon.c b/src/rx/rx_kcommon.c index 542df8592..110ba6010 100644 --- a/src/rx/rx_kcommon.c +++ b/src/rx/rx_kcommon.c @@ -20,6 +20,7 @@ #include "rx_packet.h" #include "rx_internal.h" #include "rx_stats.h" +#include "rx_peer.h" #ifdef AFS_HPUX110_ENV #include "h/tihdr.h" diff --git a/src/rx/rx_packet.c b/src/rx/rx_packet.c index a92ae3825..c605d7d43 100644 --- a/src/rx/rx_packet.c +++ b/src/rx/rx_packet.c @@ -66,6 +66,7 @@ #include "rx_internal.h" #include "rx_stats.h" +#include "rx_peer.h" #include "rx_conn.h" #include "rx_call.h" diff --git a/src/rx/rx_peer.c b/src/rx/rx_peer.c new file mode 100644 index 000000000..28dda4701 --- /dev/null +++ b/src/rx/rx_peer.c @@ -0,0 +1,27 @@ +/* + * Copyright 2000, International Business Machines Corporation and others. + * All Rights Reserved. + * + * This software has been released under the terms of the IBM Public + * License. For details, see the LICENSE file in the top-level source + * directory or online at http://www.openafs.org/dl/license10.html + */ + +#include +#include + +#include + +#include "rx.h" + +#include "rx_atomic.h" +#include "rx_clock.h" +#include "rx_peer.h" + +afs_uint32 rx_HostOf(struct rx_peer *peer) { + return peer->host; +} + +u_short rx_PortOf(struct rx_peer *peer) { + return peer->port; +} diff --git a/src/rx/rx_peer.h b/src/rx/rx_peer.h new file mode 100644 index 000000000..90fe76bba --- /dev/null +++ b/src/rx/rx_peer.h @@ -0,0 +1,81 @@ +/* + * Copyright 2000, International Business Machines Corporation and others. + * All Rights Reserved. + * + * This software has been released under the terms of the IBM Public + * License. For details, see the LICENSE file in the top-level source + * directory or online at http://www.openafs.org/dl/license10.html + */ + +#ifndef OPENAFS_RX_PEER_H +#define OPENAFS_RX_PEER_H + +/* A peer refers to a peer process, specified by a (host,port) pair. There may + * be more than one peer on a given host. */ + +#ifdef KDUMP_RX_LOCK +struct rx_peer_rx_lock { + struct rx_peer_rx_lock *next; /* Next in hash conflict or free list */ +#else +struct rx_peer { + struct rx_peer *next; /* Next in hash conflict or free list */ +#endif +#ifdef RX_ENABLE_LOCKS + afs_kmutex_t peer_lock; /* Lock peer */ +#endif /* RX_ENABLE_LOCKS */ + afs_uint32 host; /* Remote IP address, in net byte order */ + u_short port; /* Remote UDP port, in net byte order */ + + /* interface mtu probably used for this host - includes RX Header */ + u_short ifMTU; /* doesn't include IP header */ + + /* For garbage collection */ + afs_uint32 idleWhen; /* When the refcountwent to zero */ + afs_int32 refCount; /* Reference count for this structure (rx_peerHashTable_lock) */ + + /* Congestion control parameters */ + u_char burstSize; /* Reinitialization size for the burst parameter */ + u_char burst; /* Number of packets that can be transmitted right now, without pausing */ + struct clock burstWait; /* Delay until new burst is allowed */ + struct rx_queue congestionQueue; /* Calls that are waiting for non-zero burst value */ + int rtt; /* Smoothed round trip time, measured in milliseconds/8 */ + int rtt_dev; /* Smoothed rtt mean difference, in milliseconds/4 */ + int nSent; /* Total number of distinct data packets sent, not including retransmissions */ + int reSends; /* Total number of retransmissions for this peer, since this structure was created */ + +/* Skew: if a packet is received N packets later than expected (based + * on packet serial numbers), then we define it to have a skew of N. + * The maximum skew values allow us to decide when a packet hasn't + * been received yet because it is out-of-order, as opposed to when it + * is likely to have been dropped. */ + afs_uint32 inPacketSkew; /* Maximum skew on incoming packets */ + afs_uint32 outPacketSkew; /* Peer-reported max skew on our sent packets */ + + /* the "natural" MTU, excluding IP,UDP headers, is negotiated by the endpoints */ + u_short natMTU; + u_short maxMTU; + /* negotiated maximum number of packets to send in a single datagram. */ + u_short maxDgramPackets; + /* local maximum number of packets to send in a single datagram. */ + u_short ifDgramPackets; + /* + * MTU, cwind, and nDgramPackets are used to initialize + * slow start parameters for new calls. These values are set whenever a + * call sends a retransmission and at the end of each call. + * congestSeq is incremented each time the congestion parameters are + * changed by a call recovering from a dropped packet. A call used + * MAX when updating congestion parameters if it started with the + * current congestion sequence number, otherwise it uses MIN. + */ + u_short MTU; /* MTU for AFS 3.4a jumboGrams */ + u_short cwind; /* congestion window */ + u_short nDgramPackets; /* number packets per AFS 3.5 jumbogram */ + u_short congestSeq; /* Changed when a call retransmits */ + afs_hyper_t bytesSent; /* Number of bytes sent to this peer */ + afs_hyper_t bytesReceived; /* Number of bytes received from this peer */ + struct rx_queue rpcStats; /* rpc statistic list */ + int lastReachTime; /* Last time we verified reachability */ + afs_int32 maxPacketSize; /* peer packetsize hint */ +}; + +#endif diff --git a/src/rx/rx_user.c b/src/rx/rx_user.c index 2cc9c2d14..aa85c2613 100644 --- a/src/rx/rx_user.c +++ b/src/rx/rx_user.c @@ -48,6 +48,7 @@ #include "rx_atomic.h" #include "rx_globals.h" #include "rx_stats.h" +#include "rx_peer.h" #include "rx_packet.h" #ifdef AFS_PTHREAD_ENV diff --git a/src/shlibafsrpc/Makefile.in b/src/shlibafsrpc/Makefile.in index 8fdb756a0..c4cfa37d8 100644 --- a/src/shlibafsrpc/Makefile.in +++ b/src/shlibafsrpc/Makefile.in @@ -78,6 +78,7 @@ RXOBJS =\ rx_stats.o \ rx_trace.o \ rx_multi.o \ + rx_peer.o \ rx_conn.o \ rx_call.o @@ -168,9 +169,12 @@ rx_conncache.o: ${RX}/rx_conncache.c rx_call.o: ${RX}/rx_call.c $(AFS_CCRULE) $(RX)/rx_call.c -rx_conn.o : ${RX}/rx_conn.c +rx_conn.o: ${RX}/rx_conn.c $(AFS_CCRULE) $(RX)/rx_conn.c +rx_peer.o: ${RX}/rx_peer.c + $(AFS_CCRULE) $(RX)/rx_peer.c + rx_null.o: ${RX}/rx_null.c $(AFS_CCRULE) $(RX)/rx_null.c diff --git a/src/shlibafsrpc/libafsrpc.map b/src/shlibafsrpc/libafsrpc.map index e85162ecf..95841c4e9 100755 --- a/src/shlibafsrpc/libafsrpc.map +++ b/src/shlibafsrpc/libafsrpc.map @@ -179,6 +179,8 @@ rx_GetSecurityHeaderSize; rx_SetSecurityHeaderSize; rx_SetSecurityMaxTrailerSize; + rx_HostOf; + rx_PortOf; local: *; }; diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index 28a5de03d..c2658ff9e 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -5505,7 +5505,7 @@ common_GiveUpCallBacks(struct rx_call *acall, struct AFSCBFids *FidArray, if (!FidArray && !CallBackArray) { ViceLog(1, ("SAFS_GiveUpAllCallBacks: host=%x\n", - (rx_PeerOf(tcon) ? rx_PeerOf(tcon)->host : 0))); + (rx_PeerOf(tcon) ? rx_HostOf(rx_PeerOf(tcon)) : 0))); errorCode = GetClient(tcon, &client); if (!errorCode) { H_LOCK; @@ -5518,7 +5518,7 @@ common_GiveUpCallBacks(struct rx_call *acall, struct AFSCBFids *FidArray, ViceLog(0, ("GiveUpCallBacks: #Fids %d < #CallBacks %d, host=%x\n", FidArray->AFSCBFids_len, CallBackArray->AFSCBs_len, - (rx_PeerOf(tcon) ? rx_PeerOf(tcon)->host : 0))); + (rx_PeerOf(tcon) ? rx_HostOf(rx_PeerOf(tcon)) : 0))); errorCode = EINVAL; goto Bad_GiveUpCallBacks; } -- 2.39.5