diff -uprN bird-as4-md5old/nest/a-path.c bird-as4-md5/nest/a-path.c --- bird-as4-md5old/nest/a-path.c 2008-10-13 23:41:05.000000000 +0200 +++ bird-as4-md5/nest/a-path.c 2008-10-07 19:00:12.000000000 +0200 @@ -100,7 +100,6 @@ as_path_convert_to_old(struct adata *pat return dst - dst_start; } - int as_path_convert_to_new(struct adata *path, byte *dst, int req_as) { @@ -141,8 +140,6 @@ as_path_convert_to_new(struct adata *pat return dst - dst_start; } - - void as_path_format(struct adata *path, byte *buf, unsigned int size) { diff -uprN bird-as4-md5old/nest/attrs.h bird-as4-md5/nest/attrs.h --- bird-as4-md5old/nest/attrs.h 2008-10-13 23:41:05.000000000 +0200 +++ bird-as4-md5/nest/attrs.h 2008-10-07 19:04:14.000000000 +0200 @@ -17,6 +17,9 @@ #define AS_PATH_MAXLEN 10000 #define AS_TRANS 23456 +/* AS_TRANS is used when we need to store 32bit ASN larger than 0xFFFF + * to 16bit slot (like in 16bit AS_PATH). See RFC 4893 for details + */ struct adata *as_path_prepend(struct linpool *pool, struct adata *olda, u32 as); int as_path_convert_to_old(struct adata *path, byte *dst, int *new_used); diff -uprN bird-as4-md5old/sysdep/unix/io.c bird-as4-md5/sysdep/unix/io.c --- bird-as4-md5old/sysdep/unix/io.c 2008-10-13 23:41:50.000000000 +0200 +++ bird-as4-md5/sysdep/unix/io.c 2008-10-13 23:43:09.000000000 +0200 @@ -644,14 +644,7 @@ bad: } -/* Add / remove MD5 signature association for given socket. - * There is a set of pairs (address, password) used to choose - * password according to address of the other side. - * When called with passwd != NULL, the new pair is added, - * When called with passwd == NULL, the existing pair is removed. - * - * FIXME: check portability - */ +/* FIXME: check portability */ static int sk_set_md5_auth_int(sock *s, sockaddr *sa, char *passwd) @@ -688,6 +681,24 @@ sk_set_md5_auth_int(sock *s, sockaddr *s return rv; } +/** + * sk_set_md5_auth - add / remove MD5 security association for given socket. + * @s: socket + * @a: IP address of the other side + * @passwd: password used for MD5 authentication + * + * In TCP MD5 handling code in kernel, there is a set of pairs + * (address, password) used to choose password according to + * address of the other side. This function is useful for + * listening socket, for active sockets it is enough to set + * s->password field. + * + * When called with passwd != NULL, the new pair is added, + * When called with passwd == NULL, the existing pair is removed. + * + * Result: 0 for success, -1 for an error. + */ + int sk_set_md5_auth(sock *s, ip_addr a, char *passwd) { @@ -861,7 +872,7 @@ sk_open(sock *s) } fill_in_sockaddr(&sa, s->daddr, s->dport); - if (s->password != NULL) + if (s->password) { int rv = sk_set_md5_auth_int(s, &sa, s->password); if (rv < 0)