at_rmx.c (165972) | at_rmx.c (194818) |
---|---|
1/*- 2 * Copyright 1994, 1995 Massachusetts Institute of Technology 3 * 4 * Permission to use, copy, modify, and distribute this software and 5 * its documentation for any purpose and without fee is hereby 6 * granted, provided that both the above copyright notice and this 7 * permission notice appear in all copies, that both the above 8 * copyright notice and this permission notice appear in all --- 13 unchanged lines hidden (view full) --- 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 26 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * at_rmx.c,v 1.13 1995/05/30 08:09:31 rgrimes Exp | 1/*- 2 * Copyright 1994, 1995 Massachusetts Institute of Technology 3 * 4 * Permission to use, copy, modify, and distribute this software and 5 * its documentation for any purpose and without fee is hereby 6 * granted, provided that both the above copyright notice and this 7 * permission notice appear in all copies, that both the above 8 * copyright notice and this permission notice appear in all --- 13 unchanged lines hidden (view full) --- 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 26 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * at_rmx.c,v 1.13 1995/05/30 08:09:31 rgrimes Exp |
30 * $FreeBSD: head/sys/netatalk/at_rmx.c 165972 2007-01-12 13:18:08Z rwatson $ | 30 * $FreeBSD: head/sys/netatalk/at_rmx.c 194818 2009-06-24 10:28:30Z rwatson $ |
31 */ 32 33/* This code generates debugging traces to the radix code. */ 34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/socket.h> 38 39#include <net/route.h> 40 41int at_inithead(void **head, int off); 42 | 31 */ 32 33/* This code generates debugging traces to the radix code. */ 34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/socket.h> 38 39#include <net/route.h> 40 41int at_inithead(void **head, int off); 42 |
43#if 0 |
|
43#define HEXBUF_LEN 256 44 45static const char * 46prsockaddr(void *v, char *hexbuf) 47{ 48 char *bp = &hexbuf[0]; 49 u_char *cp = v; 50 --- 9 unchanged lines hidden (view full) --- 60 *bp++ = "0123456789abcdef"[*cp / 16]; 61 *bp++ = "0123456789abcdef"[*cp % 16]; 62 } 63 } else 64 bp+= sprintf(bp, "null"); 65 *bp = '\0'; 66 return (hexbuf); 67} | 44#define HEXBUF_LEN 256 45 46static const char * 47prsockaddr(void *v, char *hexbuf) 48{ 49 char *bp = &hexbuf[0]; 50 u_char *cp = v; 51 --- 9 unchanged lines hidden (view full) --- 61 *bp++ = "0123456789abcdef"[*cp / 16]; 62 *bp++ = "0123456789abcdef"[*cp % 16]; 63 } 64 } else 65 bp+= sprintf(bp, "null"); 66 *bp = '\0'; 67 return (hexbuf); 68} |
69#endif |
|
68 69static struct radix_node * 70at_addroute(void *v_arg, void *n_arg, struct radix_node_head *head, 71 struct radix_node *treenodes) 72{ | 70 71static struct radix_node * 72at_addroute(void *v_arg, void *n_arg, struct radix_node_head *head, 73 struct radix_node *treenodes) 74{ |
73 struct radix_node *rn; 74 char hexbuf[HEXBUF_LEN]; | |
75 | 75 |
76 printf("at_addroute: v=%s\n", prsockaddr(v_arg, hexbuf)); 77 printf("at_addroute: n=%s\n", prsockaddr(n_arg, hexbuf)); 78 printf("at_addroute: head=%p treenodes=%p\n", (void *)head, 79 (void *)treenodes); 80 81 rn = rn_addroute(v_arg, n_arg, head, treenodes); 82 83 printf("at_addroute: returns rn=%p\n", (void *)rn); 84 85 return (rn); | 76 return (rn_addroute(v_arg, n_arg, head, treenodes)); |
86} 87 88static struct radix_node * 89at_matroute(void *v_arg, struct radix_node_head *head) 90{ | 77} 78 79static struct radix_node * 80at_matroute(void *v_arg, struct radix_node_head *head) 81{ |
91 struct radix_node *rn; 92 char hexbuf[HEXBUF_LEN]; | |
93 | 82 |
94 printf("at_matroute: v=%s\n", prsockaddr(v_arg, hexbuf)); 95 printf("at_matroute: head=%p\n", (void *)head); 96 97 rn = rn_match(v_arg, head); 98 99 printf("at_matroute: returnr rn=%p\n", (void *)rn); 100 101 return (rn); | 83 return (rn_match(v_arg, head)); |
102} 103 104static struct radix_node * 105at_lookup(void *v_arg, void *m_arg, struct radix_node_head *head) 106{ | 84} 85 86static struct radix_node * 87at_lookup(void *v_arg, void *m_arg, struct radix_node_head *head) 88{ |
107 struct radix_node *rn; 108 char hexbuf[HEXBUF_LEN]; | |
109 | 89 |
110 printf("at_lookup: v=%s\n", prsockaddr(v_arg, hexbuf)); 111 printf("at_lookup: n=%s\n", prsockaddr(m_arg, hexbuf)); 112 printf("at_lookup: head=%p\n", (void *)head); 113 114 rn = rn_lookup(v_arg, m_arg, head); 115 116 printf("at_lookup: returns rn=%p\n", (void *)rn); 117 118 return (rn); | 90 return (rn_lookup(v_arg, m_arg, head)); |
119} 120 121static struct radix_node * 122at_delroute(void *v_arg, void *netmask_arg, struct radix_node_head *head) 123{ | 91} 92 93static struct radix_node * 94at_delroute(void *v_arg, void *netmask_arg, struct radix_node_head *head) 95{ |
124 struct radix_node *rn; 125 char hexbuf[HEXBUF_LEN]; | |
126 | 96 |
127 printf("at_delroute: v=%s\n", prsockaddr(v_arg, hexbuf)); 128 printf("at_delroute: n=%s\n", prsockaddr(netmask_arg, hexbuf)); 129 printf("at_delroute: head=%p\n", (void *)head); 130 131 rn = rn_delete(v_arg, netmask_arg, head); 132 133 printf("at_delroute: returns rn=%p\n", (void *)rn); 134 135 return (rn); | 97 return (rn_delete(v_arg, netmask_arg, head)); |
136} 137 138/* 139 * Initialize our routing tree with debugging hooks. 140 */ 141int 142at_inithead(void **head, int off) 143{ --- 12 unchanged lines hidden --- | 98} 99 100/* 101 * Initialize our routing tree with debugging hooks. 102 */ 103int 104at_inithead(void **head, int off) 105{ --- 12 unchanged lines hidden --- |