| version 1.20, 1995/06/04 05:58:26 |
version 1.21, 1995/06/07 16:01:15 |
| Line 96 static struct ip_srcrt { |
|
| Line 96 static struct ip_srcrt { |
|
| struct in_addr route[MAX_IPOPTLEN/sizeof(struct in_addr)]; |
struct in_addr route[MAX_IPOPTLEN/sizeof(struct in_addr)]; |
| } ip_srcrt; |
} ip_srcrt; |
| |
|
| #ifdef GATEWAY |
|
| extern int if_index; |
|
| u_int32_t *ip_ifmatrix; |
|
| #endif |
|
| |
|
| static void save_rte __P((u_char *, struct in_addr)); |
static void save_rte __P((u_char *, struct in_addr)); |
| /* |
/* |
| * IP initialization: fill in IP protocol switch table. |
* IP initialization: fill in IP protocol switch table. |
|
|
| ipq.next = ipq.prev = &ipq; |
ipq.next = ipq.prev = &ipq; |
| ip_id = time.tv_sec & 0xffff; |
ip_id = time.tv_sec & 0xffff; |
| ipintrq.ifq_maxlen = ipqmaxlen; |
ipintrq.ifq_maxlen = ipqmaxlen; |
| #ifdef GATEWAY |
|
| i = (if_index + 1) * (if_index + 1) * sizeof (u_int32_t); |
|
| ip_ifmatrix = (u_int32_t *) malloc(i, M_RTABLE, M_WAITOK); |
|
| bzero((char *)ip_ifmatrix, i); |
|
| #endif |
|
| } |
} |
| |
|
| struct sockaddr_in ipaddr = { sizeof(ipaddr), AF_INET }; |
struct sockaddr_in ipaddr = { sizeof(ipaddr), AF_INET }; |
| Line 1054 ip_forward(m, srcrt) |
|
| Line 1044 ip_forward(m, srcrt) |
|
| */ |
*/ |
| mcopy = m_copy(m, 0, imin((int)ip->ip_len, 64)); |
mcopy = m_copy(m, 0, imin((int)ip->ip_len, 64)); |
| |
|
| #ifdef GATEWAY |
|
| ip_ifmatrix[rt->rt_ifp->if_index + |
|
| if_index * m->m_pkthdr.rcvif->if_index]++; |
|
| #endif |
|
| /* |
/* |
| * If forwarding packet using same interface that it came in on, |
* If forwarding packet using same interface that it came in on, |
| * perhaps should send a redirect to sender to shortcut a hop. |
* perhaps should send a redirect to sender to shortcut a hop. |