File: decode_rip.c

package info (click to toggle)
dsniff 2.4b1+debian-29
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 2,020 kB
  • sloc: ansic: 10,803; sh: 152; makefile: 126
file content (34 lines) | stat: -rw-r--r-- 583 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
 * decode_rip.c
 *
 * Routing Information Protocol.
 *
 * Copyright (c) 2000 Dug Song <dugsong@monkey.org>
 *
 * $Id: decode_rip.c,v 1.4 2001/03/15 08:33:02 dugsong Exp $
 */

#include "config.h"

#include <sys/types.h>

#include <stdio.h>
#include <string.h>

#include "decode.h"

int
decode_rip(u_char *buf, int len, u_char *obuf, int olen)
{
	if (len < 21)
		return (0);
	
	/* Version 2 simple password authentication. */
	if (buf[1] != 2 || memcmp(buf + 4, "\xff\xff\x00\x02", 4) != 0)
		return (0);
	
	buf[20] = '\0';
	
	return (snprintf(obuf, olen, "%s\n", buf + 20));
}