Thread View: news.software.nntp
18 messages
18 total messages
Started by D. Stussy
Fri, 17 Oct 2008 22:16
A pair of small patches I'd like to see in the mainstream.
Author: D. Stussy
Date: Fri, 17 Oct 2008 22:16
Date: Fri, 17 Oct 2008 22:16
76 lines
3586 bytes
3586 bytes
Re: Possible Innfeed bug - Destination has unspecified address.
This was the patch where I found the above problem (since corrected). I'd
still like to see it make it into INN in some form.
What it does: (2 parts)
- Inn: For Inn_status, it allows printing of MULTIPLE IP addresses of a
connected peer (space in buffer permitting). It makes one assumption: That
no IP address will be a substring of any other IP address of the same news
peering host. The address string buffer is (currently) 64 characters, but
IPv4 addresses are only 15 characters long maximum and IPv6 are 39. I have
found that sometimes peers connect using both (multiple connections of
course).
- Innfeed: A similar patch, showing all addresses that Innfeed thinks the
peer has. I listed this before in the bug thread.
Feel free to implement this conditionally (i.e. add some configuration
parameter to control the behavior).
Part 1:
diff -ur innd/status.c innd/status.c
--- innd/status.c 2008-05-05 10:18:36.000000000 +0000
+++ innd/status.c 2008-05-15 01:49:39.000000000 +0000
@@ -177,6 +177,15 @@
else
tmp->next = status;
tmp = status;
+ } else {
+ char *p;
+
+ p = sprint_sockaddr((struct sockaddr *)&cp->Address);
+ if ((strstr(status->ip_addr, p) == NULL) &&
+ (strlen(status->ip_addr) + strlen(p) + 1 <
sizeof(status->ip_addr))) {
+ strcat(status->ip_addr, " ");
+ strcat(status->ip_addr, p);
+ }
}
if (Now.time - cp->Started > status->seconds)
status->seconds = Now.time - cp->Started;
Part 2:
diff -ur innfeed/host.c innfeed/host.c
--- innfeed/host.c 2008-05-05 10:18:36.000000000 +0000
+++ innfeed/host.c 2008-05-14 21:50:38.000000000 +0000
@@ -3477,6 +3478,20 @@
fputc ('\n',fp) ;
+ if (host->ipAddrs) {
+ int i;
+ char *family;
+
+ for(i=0; host->ipAddrs[i] != NULL; ++i) {
+ switch(host->ipAddrs[i]->sa_family) {
+ case AF_INET: family="IPv4"; break;
+ case AF_INET6: family="IPv6"; break;
+ default: family="????"; break;
+ }
+ fprintf(fp,"Address %-2u: %-4.4s %s\n", i+1, family,
sprint_sockaddr(host->ipAddrs[i]));
+ }
+ }
+
fprintf (fp, " seconds: %-7ld art. timeout: %-5d ip name:
%s\n",
host->firstConnectTime > 0 ? (long)(now - host->firstConnectTime)
: 0,
host->params->articleTimeout, host->params->ipName) ;
Comments?
Re: A pair of small patches I'd like to see in the mainstream.
Author: Julien ÉLIE
Date: Sat, 25 Oct 2008 18:49
Date: Sat, 25 Oct 2008 18:49
100 lines
4730 bytes
4730 bytes
Hi D. Stussy,
> + } else {
> + char *p;
> +
> + p = sprint_sockaddr((struct sockaddr *)&cp->Address);
> + if ((strstr(status->ip_addr, p) == NULL) &&
> + (strlen(status->ip_addr) + strlen(p) + 1 < sizeof(status->ip_addr))) {
> + strcat(status->ip_addr, " ");
> + strcat(status->ip_addr, p);
> + }
strlcat should be used instead of strcat.
Be careful if cp->Address.ss_family is 0 (local connection)...
Suggestion for INN 2.5 (where there is no buffer of 64 chars):
Index: status.c
===================================================================
--- status.c (révision 8141)
+++ status.c (copie de travail)
@@ -22,7 +22,9 @@
typedef struct _STATUS {
char name[SMBUF];
- char ip_addr[INET6_ADDRSTRLEN];
+ /* ip_addr may contain the concatenation of an IPv4 address
+ * and an IPv6 address. */
+ char ip_addr[INET_ADDRSTRLEN + INET6_ADDRSTRLEN + 1];
bool can_stream;
unsigned short activeCxn;
unsigned short sleepingCxns;
@@ -117,6 +119,7 @@
int peers = 0;
char TempString[SMBUF];
char *path;
+ char other_ip_addr[INET6_ADDRSTRLEN];
STATUS *head, *status, *tmp;
char str[9];
time_t now;
@@ -186,7 +189,16 @@
else
tmp->next = status;
tmp = status;
+ } else if (cp->Address.ss_family != 0) {
+ network_sockaddr_sprint(other_ip_addr, sizeof(other_ip_addr),
+ (struct sockaddr *) &cp->Address);
+ /* Concatenate the addresses if it is a new one. */
+ if (strstr(status->ip_addr, other_ip_addr) == NULL) {
+ strlcat(status->ip_addr, " ", sizeof(status->ip_addr));
+ strlcat(status->ip_addr, other_ip_addr, sizeof(status->ip_addr));
+ }
}
+
if (Now.tv_sec - cp->Started > status->seconds)
status->seconds = Now.tv_sec - cp->Started;
if (Now.tv_sec - cp->Started > seconds)
> diff -ur innfeed/host.c innfeed/host.c
> --- innfeed/host.c 2008-05-05 10:18:36.000000000 +0000
> +++ innfeed/host.c 2008-05-14 21:50:38.000000000 +0000
> @@ -3477,6 +3478,20 @@
>
> fputc ('\n',fp) ;
>
> + if (host->ipAddrs) {
> + int i;
> + char *family;
> +
> + for(i=0; host->ipAddrs[i] != NULL; ++i) {
> + switch(host->ipAddrs[i]->sa_family) {
> + case AF_INET: family="IPv4"; break;
> + case AF_INET6: family="IPv6"; break;
> + default: family="????"; break;
> + }
> + fprintf(fp,"Address %-2u: %-4.4s %s\n", i+1, family, sprint_sockaddr(host->ipAddrs[i]));
> + }
> + }
> +
> fprintf (fp, " seconds: %-7ld art. timeout: %-5d ip name: %s\n",
> host->firstConnectTime > 0 ? (long)(now - host->firstConnectTime) : 0,
> host->params->articleTimeout, host->params->ipName) ;
>
>
> Comments?
It looks good to me. But #ifdef for IPv6 capability should be added; otherwise,
there are compilation issues on some platforms...
--
Julien ÉLIE
« Avec les machines NEDAP, le vote est TELLEMENT secret que même les
électeurs n'ont aucune garantie que leur vote soit réellement crédité au
compte de voix du candidat de son choix ! »
Re: A pair of small patches I'd like to see in the mainstream.
Author: D. Stussy
Date: Sun, 26 Oct 2008 06:00
Date: Sun, 26 Oct 2008 06:00
135 lines
6545 bytes
6545 bytes
"Julien ÉLIE" <iulius@nom-de-mon-site.com.invalid> wrote in message
news:gdvpnh$qvj$1@news.trigofacile.com...
> Hi D. Stussy,
>
> > + } else {
> > + char *p;
> > +
> > + p = sprint_sockaddr((struct sockaddr *)&cp->Address);
> > + if ((strstr(status->ip_addr, p) == NULL) &&
> > + (strlen(status->ip_addr) + strlen(p) + 1 <
sizeof(status->ip_addr))) {
> > + strcat(status->ip_addr, " ");
> > + strcat(status->ip_addr, p);
> > + }
>
> strlcat should be used instead of strcat.
> Be careful if cp->Address.ss_family is 0 (local connection)...
1) "strlcat"? If by this you mean a strcat with a maximum length to copy
specified, note that such is unnecessary as the routine has already checked
to make certain sufficient space exists. It cannot overrun the destination
string length.
2) Any issue with cp->Address fields should be handled by the called
subroutine. However, note that since this ADDS an address to a string that
ALREADY HAS and address, the data design may already exclude local
connections.
3) There should be a better way of checking of the address already appears
in the list than strstr, but how often in the real world does one address in
use be a non-identical substring of another in use at the same host? I
suppose that "10.x.y.24" and "10.x.y.247" could be in use, and if so, a
".24" found after the ".247" would be a substring and ignored. However, I
considered that so remote as to be negligible, and if it were to happen,
it's no worse than the original code that only prints the first address
found.
Although your suggested code for v2.5 below assumes one IPv4 and one IPv6,
please also note that my design will handle multiple addresses of either
family in any combination. I note that two of my real-world peers have
multiple IPv4 addresses that they use to send to me, and I have seen
instances where two or more of the same address family were simultaneously
in use. I believe that your code may execute the strlcats even if they
don't change the string while my code will skip them if there's insufficient
room. It's also possible that your code may add multiple spaces before
concatenating an address, while mine won't (e.g. enough room to add the
separating space but not the address, and later, a shorter address that fits
is found). By changing the conditional and using strlcat, you may have
introduced undesired side effects.
> Suggestion for INN 2.5 (where there is no buffer of 64 chars):
>
> Index: status.c
> ===================================================================
> --- status.c (révision 8141)
> +++ status.c (copie de travail)
> @@ -22,7 +22,9 @@
>
> typedef struct _STATUS {
> char name[SMBUF];
> - char ip_addr[INET6_ADDRSTRLEN];
> + /* ip_addr may contain the concatenation of an IPv4 address
> + * and an IPv6 address. */
> + char ip_addr[INET_ADDRSTRLEN + INET6_ADDRSTRLEN + 1];
> bool can_stream;
> unsigned short activeCxn;
> unsigned short sleepingCxns;
> @@ -117,6 +119,7 @@
> int peers = 0;
> char TempString[SMBUF];
> char *path;
> + char other_ip_addr[INET6_ADDRSTRLEN];
> STATUS *head, *status, *tmp;
> char str[9];
> time_t now;
> @@ -186,7 +189,16 @@
> else
> tmp->next = status;
> tmp = status;
> + } else if (cp->Address.ss_family != 0) {
> + network_sockaddr_sprint(other_ip_addr, sizeof(other_ip_addr),
> + (struct sockaddr *) &cp->Address);
> + /* Concatenate the addresses if it is a new one. */
> + if (strstr(status->ip_addr, other_ip_addr) == NULL) {
> + strlcat(status->ip_addr, " ", sizeof(status->ip_addr));
> + strlcat(status->ip_addr, other_ip_addr, sizeof(status->ip_addr));
> + }
> }
> +
> if (Now.tv_sec - cp->Started > status->seconds)
> status->seconds = Now.tv_sec - cp->Started;
> if (Now.tv_sec - cp->Started > seconds)
>
>
>
>
> > diff -ur innfeed/host.c innfeed/host.c
> > --- innfeed/host.c 2008-05-05 10:18:36.000000000 +0000
> > +++ innfeed/host.c 2008-05-14 21:50:38.000000000 +0000
> > @@ -3477,6 +3478,20 @@
> >
> > fputc ('\n',fp) ;
> >
> > + if (host->ipAddrs) {
> > + int i;
> > + char *family;
> > +
> > + for(i=0; host->ipAddrs[i] != NULL; ++i) {
> > + switch(host->ipAddrs[i]->sa_family) {
> > + case AF_INET: family="IPv4"; break;
> > + case AF_INET6: family="IPv6"; break;
> > + default: family="????"; break;
> > + }
> > + fprintf(fp,"Address %-2u: %-4.4s %s\n", i+1, family,
sprint_sockaddr(host->ipAddrs[i]));
> > + }
> > + }
> > +
> > fprintf (fp, " seconds: %-7ld art. timeout: %-5d ip name:
%s\n",
> > host->firstConnectTime > 0 ? (long)(now -
host->firstConnectTime) : 0,
> > host->params->articleTimeout, host->params->ipName) ;
> >
> >
> > Comments?
>
> It looks good to me. But #ifdef for IPv6 capability should be added;
otherwise,
> there are compilation issues on some platforms...
Point noted. Don't forget #ifdef's for IPv4 too (someone may compile an
IPv6-only version someday).
Re: A pair of small patches I'd like to see in the mainstream.
Author: Julien ÉLIE
Date: Sun, 26 Oct 2008 09:15
Date: Sun, 26 Oct 2008 09:15
84 lines
5188 bytes
5188 bytes
Hi D. Stussy,
> 1) "strlcat"? If by this you mean a strcat with a maximum length to copy
> specified, note that such is unnecessary as the routine has already checked
> to make certain sufficient space exists. It cannot overrun the destination
> string length.
Yep, I have seen that the routine already checks the length.
I use strlcat everywhere because of INN's coding style:
http://www.eyrie.org/~eagle/software/inn/docs/hacking.html#S9
%%
Use string handling functions that take counts for the size of the buffer
whenever possible. This means using snprintf in preference to sprintf and
using strlcpy and strlcat in preference to strcpy and strcat. Also, use strlcpy
and strlcat instead of strncpy and strncat, as it is much easier to audit uses
of the former than the latter. strlcpy is like strncpy except that it always
nul-terminates and doesn't fill the rest of the buffer with nuls, making it
more efficient. strlcat is like strncat except that it always nul-terminates
and it takes the total size of the buffer as its third argument rather than just
the amount of space left. All of these functions are guaranteed to be available;
there are replacements in lib for systems that don't have them.
If you have to use a string copying routine that doesn't nul-terminate,
use memcpy instead. Avoid introducing any uses of strcpy, strcat, strncpy,
or strncat so that we can use grep to find dangerous usages and switch them
to better functions.
%%
> 2) Any issue with cp->Address fields should be handled by the called
> subroutine. However, note that since this ADDS an address to a string that
> ALREADY HAS and address, the data design may already exclude local
> connections.
The string does not necessarily have an address: if the connection is a local
one, there is no address (ip_address is empty and it should remain empty).
I agree it should be handled by the called subroutine.
> 3) There should be a better way of checking of the address already appears
> in the list than strstr, but how often in the real world does one address in
> use be a non-identical substring of another in use at the same host? I
> suppose that "10.x.y.24" and "10.x.y.247" could be in use, and if so, a
> ".24" found after the ".247" would be a substring and ignored.
We have to manually parse it, with a pointer to the following space in ip_address,
changing it to \0 and checking if the new address is the same as this one.
Then keep the place of this pointer, revert \0 to a space and go on the cycle
to the following space.
Unless you see something easier (especially without \0)?
> Although your suggested code for v2.5 below assumes one IPv4 and one IPv6,
> please also note that my design will handle multiple addresses of either
> family in any combination.
ip_addr is not a buffer of 64 characters (as in INN 2.4) but a buffer which can
contain up to the length of an IPv6 address.
In your design for INN 2.4, you cannot have 2 full IPv6 addresses (2×39 > 64).
Neither in mine. But 2 IPv4 addresses work, as in yours.
Maybe the best solution would be to increase the size to something larger
(there is a const for 512 but it is perhaps too large...).
> I believe that your code may execute the strlcats even if they
> don't change the string while my code will skip them if there's insufficient
> room.
You're right. I should add your checks before.
> Don't forget #ifdef's for IPv4 too (someone may compile an
> IPv6-only version someday).
With #ifdef for IPv4, the whole source code of INN would have to been reviewed...
--
Julien ÉLIE
« -- Vous ne sortirez jamais d'ici étrangers ! Ce tombeau sera votre tombeau !
-- Tout cela ne serait pas arrivé dans un menhir ! » (Astérix)
Re: A pair of small patches I'd like to see in the mainstream.
Author: Russ Allbery
Date: Mon, 27 Oct 2008 05:53
Date: Mon, 27 Oct 2008 05:53
17 lines
1776 bytes
1776 bytes
Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes:
>> Don't forget #ifdef's for IPv4 too (someone may compile an
>> IPv6-only version someday).
>
> With #ifdef for IPv4, the whole source code of INN would have to been
> reviewed...
I don't think any such thing as an IPv6-only stack exists yet. I'd be
hesitant to try to port to such a thing before it exists; we'd almost
certainly guess wrong about the implications.
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Please post questions rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: A pair of small patches I'd like to see in the mainstream.
Author: D. Stussy
Date: Mon, 27 Oct 2008 06:31
Date: Mon, 27 Oct 2008 06:31
20 lines
2045 bytes
2045 bytes
"Russ Allbery" <rra@stanford.edu> wrote in message news:87zlkqd1n7.fsf@windlord.stanford.edu... > Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes: > >> Don't forget #ifdef's for IPv4 too (someone may compile an > >> IPv6-only version someday). > > > > With #ifdef for IPv4, the whole source code of INN would have to been > > reviewed... > > I don't think any such thing as an IPv6-only stack exists yet. I'd be > hesitant to try to port to such a thing before it exists; we'd almost > certainly guess wrong about the implications. Well, after we have IPv4 address exhaustion, we may have IPv6-only hosts. You've got some time to think about it. In my original post, note that the two patches may be applied separately. They are not co-dependent.
Re: A pair of small patches I'd like to see in the mainstream.
Author: Russ Allbery
Date: Sun, 02 Nov 2008 16:52
Date: Sun, 02 Nov 2008 16:52
17 lines
1894 bytes
1894 bytes
"D. Stussy" <spam@bde-arc.ampr.org> writes:
> "Russ Allbery" <rra@stanford.edu> wrote:
>> I don't think any such thing as an IPv6-only stack exists yet. I'd be
>> hesitant to try to port to such a thing before it exists; we'd almost
>> certainly guess wrong about the implications.
> Well, after we have IPv4 address exhaustion, we may have IPv6-only
> hosts. You've got some time to think about it.
An IPv6-only host is not the same thing as an IPv6-only network stack.
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Please post questions rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: A pair of small patches I'd like to see in the mainstream.
Author: D. Stussy
Date: Sun, 02 Nov 2008 22:08
Date: Sun, 02 Nov 2008 22:08
20 lines
2029 bytes
2029 bytes
"Russ Allbery" <rra@stanford.edu> wrote in message news:87ljw2kr3y.fsf@windlord.stanford.edu... > "D. Stussy" <spam@bde-arc.ampr.org> writes: > > "Russ Allbery" <rra@stanford.edu> wrote: > > >> I don't think any such thing as an IPv6-only stack exists yet. I'd be > >> hesitant to try to port to such a thing before it exists; we'd almost > >> certainly guess wrong about the implications. > > > Well, after we have IPv4 address exhaustion, we may have IPv6-only > > hosts. You've got some time to think about it. > > An IPv6-only host is not the same thing as an IPv6-only network stack. Noted, but that will also mean alot of unused code (the IPv4 stack) compiled in. Not very efficient. As I said, there's time to think about it....
Re: A pair of small patches I'd like to see in the mainstream.
Author: Russ Allbery
Date: Mon, 03 Nov 2008 05:24
Date: Mon, 03 Nov 2008 05:24
22 lines
2171 bytes
2171 bytes
"D. Stussy" <spam@bde-arc.ampr.org> writes:
> "Russ Allbery" <rra@stanford.edu> wrote:
>>> Well, after we have IPv4 address exhaustion, we may have IPv6-only
>>> hosts. You've got some time to think about it.
>> An IPv6-only host is not the same thing as an IPv6-only network stack.
> Noted, but that will also mean alot of unused code (the IPv4 stack)
> compiled in. Not very efficient.
This statement sounds reasonable in the abstract, but turns out to not be
avoidable given how the C library is structured on UNIX. There is no
separate IPv4 stack that you could selectively not compile in. There is a
single network API which handles both address types mostly transparently
to the application.
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Please post questions rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: A pair of small patches I'd like to see in the mainstream.
Author: Julien ÉLIE
Date: Tue, 18 Nov 2008 11:37
Date: Tue, 18 Nov 2008 11:37
75 lines
4241 bytes
4241 bytes
Hi D. Stussy,
> 3) There should be a better way of checking of the address already appears
> in the list than strstr, but how often in the real world does one address in
> use be a non-identical substring of another in use at the same host? I
> suppose that "10.x.y.24" and "10.x.y.247" could be in use, and if so, a
> ".24" found after the ".247" would be a substring and ignored.
Let's see whether the substring found is followed by a space or a string
termination.
> Although your suggested code for v2.5 below assumes one IPv4 and one IPv6,
> please also note that my design will handle multiple addresses of either
> family in any combination.
Now up to 256 characters (SMBUF).
I suggest:
Index: status.c
===================================================================
--- status.c (révision 8156)
+++ status.c (copie de travail)
@@ -22,7 +22,9 @@
typedef struct _STATUS {
char name[SMBUF];
- char ip_addr[INET6_ADDRSTRLEN];
+ /* ip_addr may contain a concatenation of several
+ * IPv4 and IPv6 addresses. */
+ char ip_addr[SMBUF];
bool can_stream;
unsigned short activeCxn;
unsigned short sleepingCxns;
@@ -117,6 +119,8 @@
int peers = 0;
char TempString[SMBUF];
char *path;
+ char other_ip_addr[INET6_ADDRSTRLEN];
+ char *p;
STATUS *head, *status, *tmp;
char str[9];
time_t now;
@@ -186,7 +190,21 @@
else
tmp->next = status;
tmp = status;
+ } else if (cp->Address.ss_family != 0) {
+ network_sockaddr_sprint(other_ip_addr, sizeof(other_ip_addr),
+ (struct sockaddr *) &cp->Address);
+ /* Concatenate the addresses if it is a new one.
+ * Make sure we have enough space to write the entire new address. */
+ if ( (((p = strstr(status->ip_addr, other_ip_addr)) == NULL)
+ || ((p != NULL) && (p[strlen(other_ip_addr)] != ' ')
+ && (p[strlen(other_ip_addr)] != '\0')))
+ && (strlen(status->ip_addr) + strlen(other_ip_addr) + 1 <
+ sizeof(status->ip_addr)) ) {
+ strlcat(status->ip_addr, " ", sizeof(status->ip_addr));
+ strlcat(status->ip_addr, other_ip_addr, sizeof(status->ip_addr));
+ }
}
+
if (Now.tv_sec - cp->Started > status->seconds)
status->seconds = Now.tv_sec - cp->Started;
if (Now.tv_sec - cp->Started > seconds)
--
Julien ÉLIE
« -- Il ne doit pas être loin et à pied, on va aussi vite que les bœufs !
-- Bien sûr ! Les bœufs sont à pied eux aussi ! » (Astérix)
Re: A pair of small patches I'd like to see in the mainstream.
Author: Julien ÉLIE
Date: Tue, 18 Nov 2008 11:57
Date: Tue, 18 Nov 2008 11:57
77 lines
3511 bytes
3511 bytes
Hi D. Stussy,
> - Innfeed: A similar patch, showing all addresses that Innfeed thinks the
> peer has. I listed this before in the bug thread.
>
> Comments?
Here is a suggestion for INN 2.5.
Seems to work fine:
news.cyber-rezo.net
Address 1 : IPv6 2001:41d0:1:7ae4::1
Address 2 : IPv4 91.121.71.228
seconds: 90 art. timeout: 600 ip name: news.cyber-rezo.net
offered: 4 resp. timeout: 300 port: 119
accepted: 1 want streaming: yes active cxns: 1
[...]
Index: host.c
===================================================================
--- host.c (révision 8156)
+++ host.c (copie de travail)
@@ -3312,6 +3312,7 @@
* format of the output is:
*
* sitename
+ * Address 1: IPv4 12.0.0.42
* seconds: 351 art. timeout: 400 ip name: foo.bar
* offered: 1194 resp. timeout: 240 port: 119
* accepted: 178 want streaming: yes active cxns: 6
@@ -3358,6 +3359,32 @@
fputc ('\n',fp) ;
+ if (host->ipAddrs) {
+ int i;
+ char ip_addr[INET6_ADDRSTRLEN];
+ char *family;
+
+ for(i = 0; host->ipAddrs[i] != NULL; i++) {
+ switch(host->ipAddrs[i]->sa_family) {
+ case AF_INET:
+ family = xstrdup("IPv4");
+ break;
+#ifdef HAVE_INET6
+ case AF_INET6:
+ family = xstrdup("IPv6");
+ break;
+#endif
+ default:
+ family = xstrdup("????");
+ break;
+ }
+
+ network_sockaddr_sprint(ip_addr, sizeof(ip_addr),
+ host->ipAddrs[i]);
+ fprintf(fp, "Address %-2u: %-4.4s %s\n", i+1, family, ip_addr);
+ }
+ }
+
fprintf (fp, " seconds: %-7ld art. timeout: %-5d ip name: %s\n",
host->firstConnectTime > 0 ? (long)(now - host->firstConnectTime) : 0,
host->params->articleTimeout, host->params->ipName) ;
Does it sound good to you?
--
Julien ÉLIE
« -- Il ne doit pas être loin et à pied, on va aussi vite que les bœufs !
-- Bien sûr ! Les bœufs sont à pied eux aussi ! » (Astérix)
Re: A pair of small patches I'd like to see in the mainstream.
Author: D. Stussy
Date: Wed, 19 Nov 2008 00:55
Date: Wed, 19 Nov 2008 00:55
11 lines
1999 bytes
1999 bytes
"Julien ÉLIE" <iulius@nom-de-mon-site.com.invalid> wrote in message news:gfuain$ee9$1@news.trigofacile.com... > Does it sound good to you? It's been a while since I looked at this stuff. However, it works on my system as originally posted (although I use a " Addr %-2u" string in my alpha-test version for innfeed). If you visit my server's web site, you'll see both of these. For the inn_status part, I kept the original length at 64 so that it won't cause overly-long lines when listing those with multiple addresses. The only suggestion I have at this point is that if we're going to list them all (line length being larger), then we need to remove this from column 3 of the output and put it as column 1 spanning the entire screen.
Re: A pair of small patches I'd like to see in the mainstream.
Author: Julien ÉLIE
Date: Wed, 19 Nov 2008 11:49
Date: Wed, 19 Nov 2008 11:49
30 lines
2267 bytes
2267 bytes
Hi D. Stussyn
> " Addr %-2u"
Adopted.
news.cyber-rezo.net
Addr 1 : IPv6 2001:41d0:1:7ae4::1
Addr 2 : IPv4 91.121.71.228
seconds: 90 art. timeout: 600 ip name: news.cyber-rezo.net
offered: 1 resp. timeout: 300 port: 119
> The only suggestion I have at this point is that if we're going to list them all
> (line length being larger), then we need to remove this from column 3 of the output
> and put it as column 1 spanning the entire screen.
Adopted.
news.albasani.net
ip address: 78.46.73.112
seconds: 73 duplicates: 0
offered: 7 uw newsgroups: 0 active cxns: 1
accepted: 0 uw distributions: 0 sleeping cxns: 0
--
Julien ÉLIE
« Une coupe pour trois ? Vous êtes calédoniens je présume ? » (Astérix)
Re: A pair of small patches I'd like to see in the mainstream.
Author: D. Stussy
Date: Wed, 19 Nov 2008 23:49
Date: Wed, 19 Nov 2008 23:49
34 lines
2395 bytes
2395 bytes
"Julien ÉLIE" <iulius@nom-de-mon-site.com.invalid> wrote in message news:gg0uh3$mgd$1@news.trigofacile.com... > Hi D. Stussyn > > > " Addr %-2u" > > Adopted. Actually, you shouldn't have made this change. As I said, it was in the ORIGINAL alpha-test version. (Innfeed) > news.cyber-rezo.net > Addr 1 : IPv6 2001:41d0:1:7ae4::1 > Addr 2 : IPv4 91.121.71.228 > seconds: 90 art. timeout: 600 ip name: news.cyber-rezo.net > offered: 1 resp. timeout: 300 port: 119 > > > > The only suggestion I have at this point is that if we're going to list them all > > (line length being larger), then we need to remove this from column 3 of the output > > and put it as column 1 spanning the entire screen. > > Adopted. OK. (Inn). > news.albasani.net > ip address: 78.46.73.112 > seconds: 73 duplicates: 0 > offered: 7 uw newsgroups: 0 active cxns: 1 > accepted: 0 uw distributions: 0 sleeping cxns: 0 In the empty space created in column 3, maybe should have "max allowed cxns: #" (per peer). That statistic is one that is missing from the report.
Re: A pair of small patches I'd like to see in the mainstream.
Author: Julien ÉLIE
Date: Thu, 20 Nov 2008 15:23
Date: Thu, 20 Nov 2008 15:23
76 lines
4048 bytes
4048 bytes
Hi D. Stussy,
>> > " Addr %-2u"
>>
>> Adopted.
>
> Actually, you shouldn't have made this change. As I said, it was
> in the ORIGINAL alpha-test version. (Innfeed)
In fact, I prefer the indentation. That's why I changed that.
news.cyber-rezo.net
Addr 1 : IPv6 2001:41d0:1:7ae4::1
Addr 2 : IPv4 91.121.71.228
seconds: 90 art. timeout: 600 ip name: news.cyber-rezo.net
offered: 1 resp. timeout: 300 port: 119
instead of:
news.cyber-rezo.net
Address 1 : IPv6 2001:41d0:1:7ae4::1
Address 2 : IPv4 91.121.71.228
seconds: 90 art. timeout: 600 ip name: news.cyber-rezo.net
offered: 1 resp. timeout: 300 port: 119
> In the empty space created in column 3, maybe should have "max allowed cxns: #"
> (per peer). That statistic is one that is missing from the report.
Thanks for the suggestion. Just done:
feeds.lacave.net
ip address: 217.112.180.250
seconds: 122 duplicates: 0 max allowed cxns: 8
offered: 7 uw newsgroups: 0 active cxns: 1
accepted: 0 uw distributions: 0 sleeping cxns: 0
===================================================================
--- status.c (révision 8177)
+++ status.c (copie de travail)
@@ -27,6 +27,7 @@
char ip_addr[SMBUF];
bool can_stream;
unsigned short activeCxn;
+ unsigned short maxCxn;
unsigned short sleepingCxns;
time_t seconds;
unsigned long accepted;
@@ -169,6 +170,7 @@
(struct sockaddr *) &cp->Address);
}
status->can_stream = cp->Streaming;
+ status->maxCxn = cp->MaxCnx;
status->seconds = status->Size = status->DuplicateSize = 0;
status->RejectSize = 0;
status->Ihave = status->Ihave_Duplicate =
@@ -329,7 +331,8 @@
fprintf (F, "%s\n", status->name);
fprintf (F, " ip address: %s\n", status->ip_addr);
fprintf (F, " seconds: %-7ld ", (long) status->seconds);
- fprintf (F, " duplicates: %-7ld\n", status->Duplicate);
+ fprintf (F, " duplicates: %-5ld ", status->Duplicate);
+ fprintf (F, "max allowed cxns: %d\n", status->maxCxn);
fprintf (F, " offered: %-7ld ",
status->accepted + status->refused + status->rejected);
fprintf (F, " uw newsgroups: %-7ld ", status->Unwanted_g);
--
Julien ÉLIE
« César, c'est un Jules tout de même ! » (Astérix)
Re: A pair of small patches I'd like to see in the mainstream.
Author: Julien ÉLIE
Date: Sun, 30 Nov 2008 10:38
Date: Sun, 30 Nov 2008 10:38
14 lines
1750 bytes
1750 bytes
Hi D. Stussy, > - Innfeed: A similar patch, showing all addresses that Innfeed thinks the > peer has. I listed this before in the bug thread. Even though force-ipv4: is set to true in innfeed.conf, IPv6 addresses are showing up. It may be confusing. -- Julien ÉLIE « L'informatique, c'est l'art de passer 15 jours à essayer de gagner quelques millisecondes... »
Re: A pair of small patches I'd like to see in the mainstream.
Author: D. Stussy
Date: Sun, 30 Nov 2008 22:31
Date: Sun, 30 Nov 2008 22:31
18 lines
1837 bytes
1837 bytes
"Julien ÉLIE" <iulius@nom-de-mon-site.com.invalid> wrote in message news:ggtqg6$mbg$1@news.trigofacile.com... > > - Innfeed: A similar patch, showing all addresses that Innfeed thinks the > > peer has. I listed this before in the bug thread. > > Even though force-ipv4: is set to true in innfeed.conf, IPv6 addresses are showing up. > It may be confusing. That's possible. My server is dual-stack (IPv4+IPv6) so I don't notice IPv6-isms in an IPv4 environment. Probably needs an #ifdef. I'm thinking that any #ifdef should still have the IPv6 case with an #else that says "continue;" to as to abort that loop and not print the IPv6 address. Do what you feel is correct and it probably will be.
Re: A pair of small patches I'd like to see in the mainstream.
Author: Julien ÉLIE
Date: Mon, 01 Dec 2008 18:43
Date: Mon, 01 Dec 2008 18:43
39 lines
2492 bytes
2492 bytes
Hi D. Stussy,
>> Even though force-ipv4: is set to true in innfeed.conf, IPv6 addresses
>> are showing up. It may be confusing.
>
> That's possible. My server is dual-stack (IPv4+IPv6) so I don't notice
> IPv6-isms in an IPv4 environment. Probably needs an #ifdef.
My news server is also dual-stack. I have IPv4 and IPv6.
But if I set force-ipv4: to true, innfeed does not use IPv6 (bindaddress6: none)
and, yet, the IPv6 address is written.
That looks strange.
Bug spotted in fact for force-ipv4 (only in INN 2.5.0):
--- host.c (révision 8200)
+++ host.c (copie de travail)
@@ -2739,8 +2739,9 @@
if (p->bindAddr6)
{
free(p->bindAddr6);
- p->bindAddr6 = xstrdup("none");
}
+ /* Force bindaddress6: to "none". */
+ p->bindAddr6 = xstrdup("none");
}
It now works much better!
If bindaddress6: is unset in innfeed.conf, force-ipv4: was not taken into account.
--
Julien ÉLIE
« Cela n'a rien de remarquable. Il suffit d'appuyer sur la
bonne touche au bon moment et l'instrument
joue tout seul. » (J.-S. Bach)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads