Re: tcpbench: crash with -n and -b

2012-05-04 Thread Lawrence Teo
On Fri, May 04, 2012 at 11:34:02PM +0200, Erik Lax wrote:
> Hi,
> 
> I noticed that tcpbench sometimes crashes when using -n and -b combined,
> this is because of a double-free in the client initialization loop.

This is consistently reproducible for me, if I run "tcpbench -s" in one
session and tcpbench with the following -n and -b flags in another:

$ tcpbench -v -n 50 -b 127.0.0.1 127.0.0.1
  elapsed_ms  bytes mbps   bwidth 
Trying [127.0.0.1]:12345
Try to bind to [127.0.0.1]:0
Try to bind to [127.0.0.1]:0
Try to bind to [127.0.0.1]:0
Try to bind to [127.0.0.1]:0
Try to bind to [127.0.0.1]:0
Try to bind to [127.0.0.1]:0
Try to bind to [127.0.0.1]:0
Try to bind to [127.0.0.1]:0
Try to bind to [127.0.0.1]:0
tcpbench in free(): error: chunk is already free 0x209819300
Abort trap (core dumped) 

Erik's diff fixes it for me, and the code looks good to me too. :)

Lawrence



Camara SAMSUNG PL120 49% OFF | Peninsula Valdez 75% OFF | Tandil 67% OFF | Cena Gourmet 52% OFF | Paseo en Velero 64% OFF | Lenceria Erotica 43% OFF

2012-05-04 Thread Bonus Cupon
Para visualizar correctamente este newsletter ingresa a
http://news1.bonuscupon.com.ar/r.html?uid=1.9.295h.2s.hi7mn4kifo



tcpbench: crash with -n and -b

2012-05-04 Thread Erik Lax
Hi,

I noticed that tcpbench sometimes crashes when using -n and -b combined,
this is because of a double-free in the client initialization loop.

See patch below 

Erik

Index: usr.bin/tcpbench/tcpbench.c
===
RCS file: /cvs/src/usr.bin/tcpbench/tcpbench.c,v
retrieving revision 1.34
diff -u -r1.34 tcpbench.c
--- usr.bin/tcpbench/tcpbench.c 13 Apr 2012 19:23:32 -  1.34
+++ usr.bin/tcpbench/tcpbench.c 4 May 2012 21:29:55 -
@@ -879,7 +879,6 @@
if (bind(sock, (struct sockaddr *)aib->ai_addr,
aib->ai_addrlen) == -1)
err(1, "bind");
-   freeaddrinfo(aib);
}
if (ptb->Tflag != -1 && ai->ai_family == AF_INET) {
if (setsockopt(sock, IPPROTO_IP, IP_TOS,
@@ -938,6 +937,8 @@
set_slice_timer(mainstats.nconns > 0);
}
freeaddrinfo(aitop);
+   if (aib != NULL)
+   freeaddrinfo(aib);
 
if (ptb->vflag && nconn > 1)
fprintf(stderr, "%d connections established\n",



Aumente seus GANHOS MENSAIS...PROMOÇÃO SALÁRIO...CERTO!!! Somente uma Empresa de credibilidade pode oferecer... - 69778

2012-05-04 Thread Marcio Guerra
69778



 

Ola amigo(a) Empreendedor(a).
Conheci essa oportunidade de desenvolver uma atividade a partir de casa
e obter uma stima Renda Extra junto a uma empresa siria com mais de 13
anos de mercado, achei fantastica e quero indicar para que vocj ganhar
dinheiro aproveitando suas horas livres.
A empresa i a FR Promotora, nos oferece a oportunidade de obter ganhos
semanais que podem rapidamente passar dos R$ 150,00 e ganhos mensais
superiores a R$ 1.500,00, tudo isso sem ter que comprar e nem vender
nada, apenas divulgar!

O funcionamento i muito simples:

Consiste em ganhar dinheiro divulgando os Servigos e o sistema de Renda
Extra da empresa.
Ao cadastrar-se vocj recebe um csdigo de participagco, um site
personalizado com seus dados, (como esse, clique aqui
  e veja).

A empresa nos ensinada a divulgar e ganhamos dinheiro com o resultado
das divulgagues.

Alim de garantirmos uma stima Renda Mensal e Ganhos Semanais, a empresa
ainda garante a nss participantes, os seguintes benefmcios:

- Cridito mensal no celular ou uma Loja Virtual;
- Telefone da Nextel ou Conta de conexco Banda Larga;
- Lap Top no valor de R$ 1.100,00;
- Plano de Sazde;
- Uma Moto Honda 125;
- Previdjncia Privada;
- Material de apoio ao seu trabalho e muito mais.

Vale a pena! Conhega ja esse lucrativo negscio clicando no link abaixo:

https://frpromotora.com/44637164
Qualquer dzvida entre em contato comigo.

Meu cadastro na empresa i: 44637164 

Sucesso e muita felicidade!

Aproveite!

Navegue no meu site e tera todas as informagues necessarias para tomar
uma decisco acertada e comegar a ganhar dinheiro.


Aproveite a promogco SALARIO CERTO somente uma Empresa como FR
Promotora pode oferecer uma promogco como essa nesse modelo de negscio
(EXCLUSIVO).

 
http://www.frpromotora.com/marcio637164

Contato: use o e-mail supo...@frpromotora.org

Guerra
69778



Re: How to have more than 15 pflog interfaces?

2012-05-04 Thread Henning Brauer
* Siju George  [2012-05-04 08:44]:
> On Thu, Apr 12, 2012 at 3:44 AM, Henning Brauer
>  wrote:
> > diffs are for current of course but should work for 5.1 as well -
> > dunno what you are trying.
>  I have upgraded my firewall to 5.1
> could you please give ma a unified diff or something I can try

Index: if_pflog.c
===
RCS file: /cvs/src/sys/net/if_pflog.c,v
retrieving revision 1.49
diff -u -p -r1.49 if_pflog.c
--- if_pflog.c  3 Feb 2012 01:57:50 -   1.49
+++ if_pflog.c  4 May 2012 08:59:00 -
@@ -80,6 +80,7 @@
 #endif
 
 void   pflogattach(int);
+intpflogifs_resize(size_t);
 intpflogoutput(struct ifnet *, struct mbuf *, struct sockaddr *,
   struct rtentry *);
 intpflogioctl(struct ifnet *, u_long, caddr_t);
@@ -91,16 +92,14 @@ LIST_HEAD(, pflog_softc)pflogif_list;
 struct if_clonepflog_cloner =
 IF_CLONE_INITIALIZER("pflog", pflog_clone_create, pflog_clone_destroy);
 
-struct ifnet   *pflogifs[PFLOGIFS_MAX];/* for fast access */
-struct mbuf*pflog_mhdr = NULL, *pflog_mptr = NULL;
+int  npflogifs = 0;
+struct ifnet   **pflogifs = NULL;  /* for fast access */
+struct mbuf *pflog_mhdr = NULL, *pflog_mptr = NULL;
 
 void
 pflogattach(int npflog)
 {
-   int i;
LIST_INIT(&pflogif_list);
-   for (i = 0; i < PFLOGIFS_MAX; i++)
-   pflogifs[i] = NULL;
if (pflog_mhdr == NULL)
if ((pflog_mhdr = m_get(M_DONTWAIT, MT_HEADER)) == NULL)
panic("pflogattach: no mbuf");
@@ -111,15 +110,39 @@ pflogattach(int npflog)
 }
 
 int
+pflogifs_resize(size_t n)
+{
+   struct ifnet**p;
+   int   i;
+
+   if (n > SIZE_MAX / sizeof(struct ifnet))
+   return (EINVAL);
+   if (n == 0)
+   p = NULL;
+   else
+   if ((p = malloc(n * sizeof(struct ifnet), M_DEVBUF,
+   M_NOWAIT|M_ZERO)) == NULL)
+   return (ENOMEM);
+   for (i = 0; i < n; i++)
+   if (i < npflogifs)
+   p[i] = pflogifs[i];
+   else
+   p[i] = NULL;
+
+   if (pflogifs)
+   free(pflogifs, M_DEVBUF);
+   pflogifs = p;
+   npflogifs = n;
+   return (0);
+}
+
+int
 pflog_clone_create(struct if_clone *ifc, int unit)
 {
struct ifnet *ifp;
struct pflog_softc *pflogif;
int s;
 
-   if (unit >= PFLOGIFS_MAX)
-   return (EINVAL);
-
if ((pflogif = malloc(sizeof(*pflogif),
M_DEVBUF, M_NOWAIT|M_ZERO)) == NULL)
return (ENOMEM);
@@ -144,6 +167,10 @@ pflog_clone_create(struct if_clone *ifc,
 
s = splnet();
LIST_INSERT_HEAD(&pflogif_list, pflogif, sc_list);
+   if (unit + 1 > npflogifs && pflogifs_resize(unit + 1) != 0) {
+   splx(s);
+   return (ENOMEM);
+   }
pflogifs[unit] = ifp;
splx(s);
 
@@ -154,11 +181,16 @@ int
 pflog_clone_destroy(struct ifnet *ifp)
 {
struct pflog_softc  *pflogif = ifp->if_softc;
-   int  s;
+   int  s, i;
 
s = splnet();
pflogifs[pflogif->sc_unit] = NULL;
LIST_REMOVE(pflogif, sc_list);
+
+   for (i = npflogifs; i > 0 && pflogifs[i - 1] == NULL; i--)
+   ; /* nothing */
+   if (i < npflogifs)
+   pflogifs_resize(i); /* error harmless here */
splx(s);
 
if_detach(ifp);
@@ -225,7 +257,8 @@ pflog_packet(struct pf_pdesc *pd, u_int8
if (rm == NULL || pd == NULL || pd->kif == NULL || pd->m == NULL)
return (-1);
 
-   if ((ifn = pflogifs[rm->logif]) == NULL || !ifn->if_bpf)
+   if (rm->logif >= npflogifs || (ifn = pflogifs[rm->logif]) == NULL ||
+   !ifn->if_bpf)
return (0);
 
bzero(&hdr, sizeof(hdr));


-- 
Henning Brauer, h...@bsws.de, henn...@openbsd.org
BS Web Services, http://bsws.de, Full-Service ISP
Secure Hosting, Mail and DNS Services. Dedicated Servers, Root to Fully Managed
Henning Brauer Consulting, http://henningbrauer.com/