1 /*
2  * decode_rip.c
3  *
4  * Routing Information Protocol.
5  *
6  * Copyright (c) 2000 Dug Song <dugsong@monkey.org>
7  *
8  * $Id: decode_rip.c,v 1.4 2001/03/15 08:33:02 dugsong Exp $
9  */
10 
11 #include "config.h"
12 
13 #include <sys/types.h>
14 
15 #include <stdio.h>
16 #include <string.h>
17 
18 #include "decode.h"
19 
20 int
decode_rip(u_char * buf,int len,u_char * obuf,int olen)21 decode_rip(u_char *buf, int len, u_char *obuf, int olen)
22 {
23 	if (len < 21)
24 		return (0);
25 
26 	/* Version 2 simple password authentication. */
27 	if (buf[1] != 2 || memcmp(buf + 4, "\xff\xff\x00\x02", 4) != 0)
28 		return (0);
29 
30 	buf[20] = '\0';
31 
32 	return (snprintf(obuf, olen, "%s\n", buf + 20));
33 }
34 
35