RTP stats explaination

2012-05-18 Thread Arif Hossain
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi all,
We are getting very poor quality of voice during testing of a new
filtering application of us.

The application receives packets from kernel using netfilter_queue
library. Then insert the packets into a new user managed queue and
does some transformations on it, like concatenation of udp payload.

The network is healthy. Its inside our lab. And it does not drop
packets or anything .

In our app we do not forward packet immediately. After enough packet
received to increase rtp packetization time (ptime) the we forward the
message over raw socket and set dscp to be 10 so that this time
packets can escape iptable rules.

>From client side the RTP stream analysis shows nearly every stream as
problematic. summery for some streams are given below :

Stream 1:

Max delta = 1758.72 ms at packet no. 40506
Max jitter = 231.07 ms. Mean jitter = 9.27 ms.
Max skew = -2066.18 ms.
Total RTP packets = 468   (expected 468)   Lost RTP packets = 0
(0.00%)   Sequence errors = 0
Duration 23.45 s (-22628 ms clock drift, corresponding to 281 Hz (-96.49%)

Stream 2:

Max delta = 1750.96 ms at packet no. 45453
Max jitter = 230.90 ms. Mean jitter = 7.50 ms.
Max skew = -2076.96 ms.
Total RTP packets = 468   (expected 468)   Lost RTP packets = 0
(0.00%)   Sequence errors = 0
Duration 23.46 s (-22715 ms clock drift, corresponding to 253 Hz (-96.84%)

Stream 3:

Max delta = 71.47 ms at packet no. 25009
Max jitter = 6.05 ms. Mean jitter = 2.33 ms.
Max skew = -29.09 ms.
Total RTP packets = 258   (expected 258)   Lost RTP packets = 0
(0.00%)   Sequence errors = 0
Duration 10.28 s (-10181 ms clock drift, corresponding to 76 Hz (-99.05%)

Any idea where should we look for the problem?


- --
- -aft
-BEGIN PGP SIGNATURE-
Version: OpenPGP.js v0.1
Comment: http://openpgpjs.org

wsBcBAEBAgAQBQJPtiJ7CRCJVJ6A/SK8awAAHJgH/jRURuZWygqJTX7zafjK
807MvWxODhtw2p4ZLg+sCNJ0OpZlV5GftPKwH9XB4GfUKhmTPfCZ3n8vF6PU
nWKMdBDM3D/K+DktpiGuAK90A5lwniFptN8DGt/ltqdAaSAlGbz1E6LGGdlw
1w/6lPeO3J9HKpkNQA2nfn3q/s5ZHQiYoGvgFofkm85LBSYgyn4b7YDY7qnp
wtsGkSR1h66+q37Hb+1iZyWrHj26YJ+sNRBe8GzKdEccwrKMX1gJFNl5BBfl
frGsZ3Y02cSYFg5L1vVstl8F/yTz8JXTGk6yKbtA0N+TRhI7gIJ/VItm1SJt
JcF94ylPjIWiw9Iacv8ec88=
=jiIm
-END PGP SIGNATURE-


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/caguarcvvuifevar6fctz28h7h4g+u7hnxgbo-3_eblyk+ct...@mail.gmail.com



Re: Debian Administrator's Handbook

2012-05-10 Thread Arif Hossain
On Thu, May 10, 2012 at 7:21 PM, Lars Noodén  wrote:
> The Debian Administrator's Handbook is available for sale and download:
>
>        http://debian-handbook.info/
>
> Regards,
> /Lars
>
>

Wonderful piece of work .


-- 
-aft


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/caguarcvvwo9c663qwgn2kuuw6zwwgv4gtyyap_1clocu9um...@mail.gmail.com



Re: [OT] Mails coming from "joe1assis...@gmail.com"

2012-05-02 Thread Arif Hossain
I received once...

On Wed, May 2, 2012 at 5:38 PM, Indulekha  wrote:
> On Wed, May 02, 2012 at 11:49:00AM +0300, Andrei POPESCU wrote:
>> On Lu, 30 apr 12, 20:11:36, Indulekha wrote:
>> >
>> > Ok, so I subscribed the "normal" way, and I'll just periodically purge the
>> > mails to avoid waiting for 857,000 emails to load over dialup.
>>
>> Not sure what you mean, but just about every mail retriever that I know
>> of will not re-download mail unless told so.
>>
>> In order to save bandwidth you may want to use IMAP + downloading
>> headers only ;)
>>
>
> That *is* what I do, as I said I'm stuck using an absurdly slow dial up
> connection. In this part of the country our phone lines are so bad my
> connection speed hovers between 1.5 and 5.9 kbps  (no, not a typo)!
> If you've never experienced that, you probably wouldn't understand...
> Just opening an imap mailbox with more than a few hundred messages in
> it (with header caching) can take several minutes.
> It's the only real downside to living in this extremely rural area.
>
> --
> ❤ ♫ ❤ ♫ ❤ ♫ ❤
>  Indulekha
>
>
> --
> To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
> Archive: http://lists.debian.org/20120502113859.GB5362@radhesyama
>



-- 
-aft


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CAGuaRCuvf0jPZW-3VEXecrXkpi=predbxpuqgbhkkgpzvd7...@mail.gmail.com



forwarding packets to service in same host without using loopback network

2012-04-25 Thread Arif Hossain
This question is not about linux usage. But still i think  user list
is a good crowd for linux programmer. So here it goes.
I have this libnetfilter_queue application which receives packets from
kernel based on some iptables rule. Before going straight to my
problem, i'm giving a sample workable code and other tools to set up a
test environment so that We problem definition and possible solutions
can be more accurate and robust.

The following code describes the core functionality of the application:


#include 
#include 
#include 
#include 
#include 
#include /* for NF_ACCEPT */
#include 

#include 
#define PREROUTING 0
#define POSTROUTING 4
#define OUTPUT 3


/* returns packet id */
static u_int32_t
print_pkt (struct nfq_data *tb)
{
  int id = 0;
  struct nfqnl_msg_packet_hdr *ph;
  struct nfqnl_msg_packet_hw *hwph;
  u_int32_t mark, ifi;
  int ret;
  unsigned char *data;

  ph = nfq_get_msg_packet_hdr (tb);
  if (ph)
{
  id = ntohl (ph->packet_id);
  printf ("hw_protocol=0x%04x hook=%u id=%u ",
  ntohs (ph->hw_protocol), ph->hook, id);
}

  hwph = nfq_get_packet_hw (tb);
  if (hwph)
{
  int i, hlen = ntohs (hwph->hw_addrlen);

  printf ("hw_src_addr=");
  for (i = 0; i < hlen - 1; i++)
printf ("%02x:", hwph->hw_addr[i]);
  printf ("%02x ", hwph->hw_addr[hlen - 1]);
}

  mark = nfq_get_nfmark (tb);
  if (mark)
printf ("mark=%u ", mark);

  ifi = nfq_get_indev (tb);
  if (ifi)
printf ("indev=%u ", ifi);

  ifi = nfq_get_outdev (tb);
  if (ifi)
printf ("outdev=%u ", ifi);
  ifi = nfq_get_physindev (tb);
  if (ifi)
printf ("physindev=%u ", ifi);

  ifi = nfq_get_physoutdev (tb);
  if (ifi)
printf ("physoutdev=%u ", ifi);

  ret = nfq_get_payload (tb, &data);
  if (ret >= 0)
printf ("payload_len=%d ", ret);

  fputc ('\n', stdout);

  return id;
}


static int
cb (struct nfq_q_handle *qh, struct nfgenmsg *nfmsg,
struct nfq_data *nfa, void *data)
{
  uint32_t ip_src, ip_dst;
  struct in_addr s_ip;
  struct in_addr d_ip;
  uint16_t src_port;
  uint16_t dst_port;
  int verdict;
  int id;
  int ret;
  unsigned char *buffer;
  struct nfqnl_msg_packet_hdr *ph = nfq_get_msg_packet_hdr (nfa);
  if (ph)
{
  id = ntohl (ph->packet_id);
  printf ("received packet with id %d", id);
}
  ret = nfq_get_payload (nfa, &buffer);
  ip_src = *((uint32_t *) (buffer + 12));
  ip_dst = *((uint32_t *) (buffer + 16));
  src_port = *((uint16_t *) (buffer + 20));
  dst_port = *((uint16_t *) (buffer + 22));
  s_ip.s_addr = (uint32_t) ip_src;
  d_ip.s_addr = (uint32_t) ip_dst;
  *(buffer + 26) = 0x00;
  *(buffer + 27) = 0x00;
  printf ( "source IP %s", inet_ntoa (s_ip));
  printf ( "destination IP %s", inet_ntoa (d_ip));
  printf ( "source port %d", src_port);
  printf ( "destination port %d", dst_port);
  if (ret)
{
  switch (ph->hook)
{
case PREROUTING:
  printf ( "inbound packet");
  //my_mangling_fun();
  break;
case OUTPUT:
  printf ( "outbound packet");
  //my_mangling_fun();
  break;
}
}
  verdict = nfq_set_verdict (qh, id, NF_ACCEPT, ret, buffer);
  if (verdict)
printf ( "verdict ok");
  return verdict;
}

int
main (int argc, char **argv)
{
  struct nfq_handle *h;
  struct nfq_q_handle *qh;
  struct nfnl_handle *nh;
  int fd;
  int rv;
  char buf[4096] __attribute__ ((aligned));

  printf ("opening library handle\n");
  h = nfq_open ();
  if (!h)
{
  fprintf (stderr, "error during nfq_open()\n");
  exit (1);
}

  printf ("unbinding existing nf_queue handler for AF_INET (if any)\n");
  if (nfq_unbind_pf (h, AF_INET) < 0)
{
  fprintf (stderr, "error during nfq_unbind_pf()\n");
  exit (1);
}

  printf ("binding nfnetlink_queue as nf_queue handler for AF_INET\n");
  if (nfq_bind_pf (h, AF_INET) < 0)
{
  fprintf (stderr, "error during nfq_bind_pf()\n");
  exit (1);
}

  printf ("binding this socket to queue '0'\n");
  qh = nfq_create_queue (h, 0, &cb, NULL);
  if (!qh)
{
  fprintf (stderr, "error during nfq_create_queue()\n");
  exit (1);
}

  printf ("setting copy_packet mode\n");
  if (nfq_set_mode (qh, NFQNL_COPY_PACKET, 0x) < 0)
{
  fprintf (stderr, "can't set packet_copy mode\n");
  exit (1);
}

  fd = nfq_fd (h);

  for (;;)
{
  if ((rv = recv (fd, buf, sizeof (buf), 0)) >= 0)

testing a udp socket with netcat

2012-03-14 Thread Arif Hossain
i've this udp daemon which is waiting for an incoming udp datagram. now
i want test this daemon for random garbage to test how it behaves. My
udp daemon is running because its shows on netstat. problem is if i
issue following command for putting udp datagram :
$nc -uvvz  

it does not output any thing. i have straced the udp daemon. which does
not returns from recv() call. 

my goal is to put arbitrary data on the udp socket by netcat. i do not
have any experience regarding netcat so i'm asking if anyone can help me
out with this.

thanks in advance.
-- 
"You have a voice"
The King's Speech

Public Key : $ gpg --keyserver keyserver.ubuntu.com --recv-key C88CFC23


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/1331731626.14655.7.camel@arifLaptop



Re: cron job mergelog failure

2012-02-08 Thread Arif Hossain
On Wed, 2012-02-08 at 01:27 -0500, Tony Baldwin wrote:
> I have the following in my root crontab on my webserver:
> 
> 0 1 * * * mergelog /var/log/apache2/access.log
> /var/log/apache2/other_vhosts_access.log /var/log/apache2/my.log >
> MY.log
>   4 2 1 * * * mv /var/log/apache2/MY.log /var/log/apache2/my.log
> 5 5 1 * * * webalizer
> 
> Every day I get an e-mail telling me this failed.
> 
> Now, I can go in and to this manually, 
> mergelog my.log access.log other_vhosts_access.log > MY.log
> # to merge the existing merged log with the new logs
> the 
> mv MY.log my.log
> to move the newly merged log to my.log (which webalizer is configured to
> read)
> run webalizer
> profit.
> 
> Why can't cron do it without my intervention?
> 
> ./tony
> -- 
> http://www.tonybaldwin.me
> all tony, all the time!
> 
> 

May be its because of $PATH inside cron. It will better if you use full
path of "mergelog".


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/blu0-smtp208fd6246dad94e84f6692ae...@phx.gbl