netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* can't resize payload
@ 2010-01-31 18:58 Salva
  0 siblings, 0 replies; only message in thread
From: Salva @ 2010-01-31 18:58 UTC (permalink / raw)
  To: netfilter-devel

Hi,

I try to resize the payload of TCP packed but i can't. I don't know if
this is the right way?

This is the part of code:

   len = nfq_get_payload(nfa, &full_packet);
   struct ip *iphdr = (struct ip *) full_packet;

   int              iphlen = iphdr->ip_hl<<2;
   struct tcphdr *tcp = (struct tcphdr *)((caddr_t )iphdr + iphlen);

   unsigned char *pl_data = (void *)tcp + (tcp->doff*4)+32;
   ...
   pl_data = realloc(pl_data, (strlen((char *)pl_data) ) +
(sizeof(char) * strlen(m))+1 );
   ...

This part of code works only sometimes and some others fails with
invalid pointer
Can i use realloc to allocate more memory in this case?

How can i allocate more memory for the payload?

I don't know if is the correct mailing list for this kind of questions?
If not, there's another list available?

Salva
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-01-31 18:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-31 18:58 can't resize payload Salva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).