Deleted Added
full compact
ip.c (58033) ip.c (58034)
1/*
2 * PPP IP Protocol Interface
3 *
4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
5 *
6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
7 *
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the Internet Initiative Japan. The name of the
14 * IIJ may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 *
1/*
2 * PPP IP Protocol Interface
3 *
4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
5 *
6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
7 *
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the Internet Initiative Japan. The name of the
14 * IIJ may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 *
20 * $FreeBSD: head/usr.sbin/ppp/ip.c 58033 2000-03-14 01:46:49Z brian $
20 * $FreeBSD: head/usr.sbin/ppp/ip.c 58034 2000-03-14 01:46:54Z brian $
21 *
22 * TODO:
23 * o Return ICMP message for filterd packet
24 * and optionaly record it into log.
25 */
26#include <sys/param.h>
27#include <sys/socket.h>
28#include <netinet/in.h>

--- 70 unchanged lines hidden (view full) ---

99 { 1, "IN" }, { 2, "CS" }, { 3, "CH" }, { 4, "HS" }, { 255, "*" }
100 };
101 int f;
102
103 for (f = 0; f < sizeof qtxt / sizeof *qtxt; f++)
104 if (qtxt[f].id == qclass)
105 return qtxt[f].txt;
106
21 *
22 * TODO:
23 * o Return ICMP message for filterd packet
24 * and optionaly record it into log.
25 */
26#include <sys/param.h>
27#include <sys/socket.h>
28#include <netinet/in.h>

--- 70 unchanged lines hidden (view full) ---

99 { 1, "IN" }, { 2, "CS" }, { 3, "CH" }, { 4, "HS" }, { 255, "*" }
100 };
101 int f;
102
103 for (f = 0; f < sizeof qtxt / sizeof *qtxt; f++)
104 if (qtxt[f].id == qclass)
105 return qtxt[f].txt;
106
107 snprintf(failure, sizeof failure, "<0x%02x>", qclass);
108 return failure;
107 return HexStr(qclass, failure, sizeof failure);
109}
110
111static const char *
112dns_Qtype2Txt(u_short qtype)
113{
114 static char failure[6];
115 struct {
116 u_short id;

--- 10 unchanged lines hidden (view full) ---

127 { 254, "MAILA" }, { 255, "*" }
128 };
129 int f;
130
131 for (f = 0; f < sizeof qtxt / sizeof *qtxt; f++)
132 if (qtxt[f].id == qtype)
133 return qtxt[f].txt;
134
108}
109
110static const char *
111dns_Qtype2Txt(u_short qtype)
112{
113 static char failure[6];
114 struct {
115 u_short id;

--- 10 unchanged lines hidden (view full) ---

126 { 254, "MAILA" }, { 255, "*" }
127 };
128 int f;
129
130 for (f = 0; f < sizeof qtxt / sizeof *qtxt; f++)
131 if (qtxt[f].id == qtype)
132 return qtxt[f].txt;
133
135 snprintf(failure, sizeof failure, "<0x%02x>", qtype);
136 return failure;
134 return HexStr(qtype, failure, sizeof failure);
137}
138
139static __inline int
140PortMatch(int op, u_short pport, u_short rport)
141{
142 switch (op) {
143 case OP_EQ:
144 return (pport == rport);

--- 594 unchanged lines hidden ---
135}
136
137static __inline int
138PortMatch(int op, u_short pport, u_short rport)
139{
140 switch (op) {
141 case OP_EQ:
142 return (pport == rport);

--- 594 unchanged lines hidden ---