Fossil SCM

Use the hostname as the report IP when doing SSH synchronization.

drh 2023-01-13 14:34 trunk merge
Commit 0b7af9d8653d35fd833ce483770cbd4df0123fda317d2dd9a9235e4361c37776
--- src/http_socket.c
+++ src/http_socket.c
@@ -232,33 +232,5 @@
232232
N -= (size_t)got;
233233
pContent = (void*)&((char*)pContent)[got];
234234
}
235235
return total;
236236
}
237
-
238
-/*
239
-** Attempt to resolve pUrlData->name to an IP address and setup g.zIpAddr
240
-** so rcvfrom gets populated. For hostnames with more than one IP (or
241
-** if overridden in ~/.ssh/config) the rcvfrom may not match the host
242
-** to which we connect.
243
-*/
244
-void socket_ssh_resolve_addr(UrlData *pUrlData){
245
- struct addrinfo *ai = 0;
246
- struct addrinfo hints;
247
- char zRemote[NI_MAXHOST];
248
- memset(&hints, 0, sizeof(hints));
249
- hints.ai_family = AF_UNSPEC;
250
- hints.ai_socktype = SOCK_STREAM;
251
- hints.ai_protocol = IPPROTO_TCP;
252
- fossil_free(g.zIpAddr);
253
- g.zIpAddr = 0;
254
- if( getaddrinfo(pUrlData->name, NULL, &hints, &ai)==0
255
- && ai!=0
256
- && getnameinfo(ai->ai_addr, ai->ai_addrlen, zRemote,
257
- sizeof(zRemote), 0, 0, NI_NUMERICHOST)==0 ){
258
- g.zIpAddr = mprintf("%s (%s)", zRemote, pUrlData->name);
259
- }
260
- if( ai ) freeaddrinfo(ai);
261
- if( g.zIpAddr==0 ){
262
- g.zIpAddr = mprintf("%s", pUrlData->name);
263
- }
264
-}
265237
--- src/http_socket.c
+++ src/http_socket.c
@@ -232,33 +232,5 @@
232 N -= (size_t)got;
233 pContent = (void*)&((char*)pContent)[got];
234 }
235 return total;
236 }
237
238 /*
239 ** Attempt to resolve pUrlData->name to an IP address and setup g.zIpAddr
240 ** so rcvfrom gets populated. For hostnames with more than one IP (or
241 ** if overridden in ~/.ssh/config) the rcvfrom may not match the host
242 ** to which we connect.
243 */
244 void socket_ssh_resolve_addr(UrlData *pUrlData){
245 struct addrinfo *ai = 0;
246 struct addrinfo hints;
247 char zRemote[NI_MAXHOST];
248 memset(&hints, 0, sizeof(hints));
249 hints.ai_family = AF_UNSPEC;
250 hints.ai_socktype = SOCK_STREAM;
251 hints.ai_protocol = IPPROTO_TCP;
252 fossil_free(g.zIpAddr);
253 g.zIpAddr = 0;
254 if( getaddrinfo(pUrlData->name, NULL, &hints, &ai)==0
255 && ai!=0
256 && getnameinfo(ai->ai_addr, ai->ai_addrlen, zRemote,
257 sizeof(zRemote), 0, 0, NI_NUMERICHOST)==0 ){
258 g.zIpAddr = mprintf("%s (%s)", zRemote, pUrlData->name);
259 }
260 if( ai ) freeaddrinfo(ai);
261 if( g.zIpAddr==0 ){
262 g.zIpAddr = mprintf("%s", pUrlData->name);
263 }
264 }
265
--- src/http_socket.c
+++ src/http_socket.c
@@ -232,33 +232,5 @@
232 N -= (size_t)got;
233 pContent = (void*)&((char*)pContent)[got];
234 }
235 return total;
236 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
237
--- src/http_transport.c
+++ src/http_transport.c
@@ -117,11 +117,12 @@
117117
** to talk to the remote machine.
118118
*/
119119
Blob zCmd; /* The SSH command */
120120
char *zHost; /* The host name to contact */
121121
122
- socket_ssh_resolve_addr(pUrlData);
122
+ fossil_free(g.zIpAddr);
123
+ g.zIpAddr = mprintf("%s", pUrlData->name);
123124
transport_ssh_command(&zCmd);
124125
if( pUrlData->port!=pUrlData->dfltPort && pUrlData->port ){
125126
blob_appendf(&zCmd, " -p %d", pUrlData->port);
126127
}
127128
blob_appendf(&zCmd, " -T --"); /* End of switches */
128129
--- src/http_transport.c
+++ src/http_transport.c
@@ -117,11 +117,12 @@
117 ** to talk to the remote machine.
118 */
119 Blob zCmd; /* The SSH command */
120 char *zHost; /* The host name to contact */
121
122 socket_ssh_resolve_addr(pUrlData);
 
123 transport_ssh_command(&zCmd);
124 if( pUrlData->port!=pUrlData->dfltPort && pUrlData->port ){
125 blob_appendf(&zCmd, " -p %d", pUrlData->port);
126 }
127 blob_appendf(&zCmd, " -T --"); /* End of switches */
128
--- src/http_transport.c
+++ src/http_transport.c
@@ -117,11 +117,12 @@
117 ** to talk to the remote machine.
118 */
119 Blob zCmd; /* The SSH command */
120 char *zHost; /* The host name to contact */
121
122 fossil_free(g.zIpAddr);
123 g.zIpAddr = mprintf("%s", pUrlData->name);
124 transport_ssh_command(&zCmd);
125 if( pUrlData->port!=pUrlData->dfltPort && pUrlData->port ){
126 blob_appendf(&zCmd, " -p %d", pUrlData->port);
127 }
128 blob_appendf(&zCmd, " -T --"); /* End of switches */
129
+1 -1
--- src/xfer.c
+++ src/xfer.c
@@ -2856,11 +2856,11 @@
28562856
}
28572857
28582858
fossil_force_newline();
28592859
if( g.zHttpCmd==0 ){
28602860
fossil_print(
2861
- "%s done, wire bytes sent: %lld received: %lld ip: %s\n",
2861
+ "%s done, wire bytes sent: %lld received: %lld remote: %s\n",
28622862
zOpType, nSent, nRcvd, g.zIpAddr);
28632863
}
28642864
if( syncFlags & SYNC_VERBOSE ){
28652865
fossil_print(
28662866
"Uncompressed payload sent: %lld received: %lld\n", nUncSent, nUncRcvd);
28672867
--- src/xfer.c
+++ src/xfer.c
@@ -2856,11 +2856,11 @@
2856 }
2857
2858 fossil_force_newline();
2859 if( g.zHttpCmd==0 ){
2860 fossil_print(
2861 "%s done, wire bytes sent: %lld received: %lld ip: %s\n",
2862 zOpType, nSent, nRcvd, g.zIpAddr);
2863 }
2864 if( syncFlags & SYNC_VERBOSE ){
2865 fossil_print(
2866 "Uncompressed payload sent: %lld received: %lld\n", nUncSent, nUncRcvd);
2867
--- src/xfer.c
+++ src/xfer.c
@@ -2856,11 +2856,11 @@
2856 }
2857
2858 fossil_force_newline();
2859 if( g.zHttpCmd==0 ){
2860 fossil_print(
2861 "%s done, wire bytes sent: %lld received: %lld remote: %s\n",
2862 zOpType, nSent, nRcvd, g.zIpAddr);
2863 }
2864 if( syncFlags & SYNC_VERBOSE ){
2865 fossil_print(
2866 "Uncompressed payload sent: %lld received: %lld\n", nUncSent, nUncRcvd);
2867

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button