summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authormaxim <maxim@FreeBSD.org>2002-12-24 13:45:24 +0000
committermaxim <maxim@FreeBSD.org>2002-12-24 13:45:24 +0000
commitaa1de6479fe7e33be998a7186b8847bb0a9f9425 (patch)
tree8f2ef9a01a0a1d62c80be624da8f68cc7d269a95 /sys/netinet
parent4979ab8d816b8ab1d2eb74e7179f8f63e04f0972 (diff)
downloadFreeBSD-src-aa1de6479fe7e33be998a7186b8847bb0a9f9425.zip
FreeBSD-src-aa1de6479fe7e33be998a7186b8847bb0a9f9425.tar.gz
o De-anonymity dummynet(4) and ipfw(4) messages, prepend them
by 'dummynet: ' and 'ipfw: ' prefixes. PR: kern/41609
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/ip_dummynet.c61
-rw-r--r--sys/netinet/ip_fw2.c31
2 files changed, 47 insertions, 45 deletions
diff --git a/sys/netinet/ip_dummynet.c b/sys/netinet/ip_dummynet.c
index 67036e0..9cd2d6f 100644
--- a/sys/netinet/ip_dummynet.c
+++ b/sys/netinet/ip_dummynet.c
@@ -171,7 +171,8 @@ rt_unref(struct rtentry *rt)
if (rt == NULL)
return ;
if (rt->rt_refcnt <= 0)
- printf("-- warning, refcnt now %ld, decreasing\n", rt->rt_refcnt);
+ printf("dummynet: warning, refcnt now %ld, decreasing\n",
+ rt->rt_refcnt);
RTFREE(rt);
}
@@ -200,14 +201,14 @@ heap_init(struct dn_heap *h, int new_size)
struct dn_heap_entry *p;
if (h->size >= new_size ) {
- printf("heap_init, Bogus call, have %d want %d\n",
+ printf("dummynet: heap_init, Bogus call, have %d want %d\n",
h->size, new_size);
return 0 ;
}
new_size = (new_size + HEAP_INCREMENT ) & ~HEAP_INCREMENT ;
p = malloc(new_size * sizeof(*p), M_DUMMYNET, M_NOWAIT);
if (p == NULL) {
- printf(" heap_init, resize %d failed\n", new_size );
+ printf("dummynet: heap_init, resize %d failed\n", new_size );
return 1 ; /* error */
}
if (h->size > 0) {
@@ -278,18 +279,18 @@ heap_extract(struct dn_heap *h, void *obj)
int child, father, max = h->elements - 1 ;
if (max < 0) {
- printf("warning, extract from empty heap 0x%p\n", h);
+ printf("dummynet: warning, extract from empty heap 0x%p\n", h);
return ;
}
father = 0 ; /* default: move up smallest child */
if (obj != NULL) { /* extract specific element, index is at offset */
if (h->offset <= 0)
- panic("*** heap_extract from middle not supported on this heap!!!\n");
+ panic("dummynet: heap_extract from middle not supported on this heap!!!\n");
father = *((int *)((char *)obj + h->offset)) ;
if (father < 0 || father >= h->elements) {
printf("dummynet: heap_extract, father %d out of bound 0..%d\n",
father, h->elements);
- panic("heap_extract");
+ panic("dummynet: heap_extract");
}
}
RESET_OFFSET(h, father);
@@ -433,7 +434,7 @@ transmit_event(struct dn_pipe *pipe)
case DN_TO_BDG_FWD :
if (!BDG_LOADED) {
/* somebody unloaded the bridge module. Drop pkt */
- printf("-- dropping bridged packet trapped in pipe--\n");
+ printf("dummynet: dropping bridged packet trapped in pipe\n");
m_freem(pkt->dn_m);
break;
} /* fallthrough */
@@ -528,7 +529,7 @@ ready_event(struct dn_flow_queue *q)
int p_was_empty ;
if (p == NULL) {
- printf("ready_event- pipe is gone\n");
+ printf("dummynet: ready_event- pipe is gone\n");
return ;
}
p_was_empty = (p->head == NULL) ;
@@ -595,7 +596,7 @@ ready_event_wfq(struct dn_pipe *p)
if (p->ifp && p->ifp->if_snd.ifq_head != NULL)
return ;
else {
- DEB(printf("pipe %d ready from %s --\n",
+ DEB(printf("dummynet: pipe %d ready from %s --\n",
p->pipe_nr, p->if_name);)
}
}
@@ -719,7 +720,7 @@ dummynet(void * __unused unused)
h = heaps[i];
while (h->elements > 0 && DN_KEY_LEQ(h->p[0].key, curr_time) ) {
DDB(if (h->p[0].key > curr_time)
- printf("-- dummynet: warning, heap %d is %d ticks late\n",
+ printf("dummynet: warning, heap %d is %d ticks late\n",
i, (int)(curr_time - h->p[0].key));)
p = h->p[0].object ; /* store a copy before heap_extract */
heap_extract(h, NULL); /* need to extract before processing */
@@ -728,7 +729,7 @@ dummynet(void * __unused unused)
else if (i == 1) {
struct dn_pipe *pipe = p;
if (pipe->if_name[0] != '\0')
- printf("*** bad ready_event_wfq for pipe %s\n",
+ printf("dummynet: bad ready_event_wfq for pipe %s\n",
pipe->if_name);
else
ready_event_wfq(p) ;
@@ -767,12 +768,12 @@ if_tx_rdy(struct ifnet *ifp)
for (p = all_pipes; p ; p = p->next )
if (!strcmp(p->if_name, buf) ) {
p->ifp = ifp ;
- DEB(printf("++ tx rdy from %s (now found)\n", buf);)
+ DEB(printf("dummynet: ++ tx rdy from %s (now found)\n", buf);)
break ;
}
}
if (p != NULL) {
- DEB(printf("++ tx rdy from %s%d - qlen %d\n", ifp->if_name,
+ DEB(printf("dummynet: ++ tx rdy from %s%d - qlen %d\n", ifp->if_name,
ifp->if_unit, ifp->if_snd.ifq_len);)
p->numbytes = 0 ; /* mark ready for I/O */
ready_event_wfq(p);
@@ -831,7 +832,7 @@ create_queue(struct dn_flow_set *fs, int i)
}
q = malloc(sizeof(*q), M_DUMMYNET, M_NOWAIT | M_ZERO);
if (q == NULL) {
- printf("sorry, cannot allocate queue for new flow\n");
+ printf("dummynet: sorry, cannot allocate queue for new flow\n");
return NULL ;
}
q->fs = fs ;
@@ -937,7 +938,7 @@ red_drops(struct dn_flow_set *fs, struct dn_flow_queue *q, int len)
/* queue in bytes or packets ? */
u_int q_size = (fs->flags_fs & DN_QSIZE_IS_BYTES) ? q->len_bytes : q->len;
- DEB(printf("\n%d q: %2u ", (int) curr_time, q_size);)
+ DEB(printf("\ndymmynet: %d q: %2u ", (int) curr_time, q_size);)
/* average queue size estimation */
if (q_size != 0) {
@@ -963,7 +964,7 @@ red_drops(struct dn_flow_set *fs, struct dn_flow_queue *q, int len)
SCALE_MUL(q->avg, fs->w_q_lookup[t]) : 0;
}
}
- DEB(printf("avg: %u ", SCALE_VAL(q->avg));)
+ DEB(printf("dummynet: avg: %u ", SCALE_VAL(q->avg));)
/* should i drop ? */
@@ -1106,7 +1107,7 @@ dummynet_io(struct mbuf *m, int pipe_nr, int dir, struct ip_fw_args *fwa)
if (pipe != NULL)
fs->pipe = pipe ;
else {
- printf("No pipe %d for queue %d, drop pkt\n",
+ printf("dummynet: no pipe %d for queue %d, drop pkt\n",
fs->parent_nr, fs->fs_nr);
goto dropit ;
}
@@ -1225,14 +1226,14 @@ dummynet_io(struct mbuf *m, int pipe_nr, int dir, struct ip_fw_args *fwa)
*/
if (DN_KEY_GT(q->S, pipe->V) ) { /* not eligible */
if (pipe->scheduler_heap.elements == 0)
- printf("++ ouch! not eligible but empty scheduler!\n");
+ printf("dummynet: ++ ouch! not eligible but empty scheduler!\n");
heap_insert(&(pipe->not_eligible_heap), q->S, q);
} else {
heap_insert(&(pipe->scheduler_heap), q->F, q);
if (pipe->numbytes >= 0) { /* pipe is idle */
if (pipe->scheduler_heap.elements != 1)
- printf("*** OUCH! pipe should have been idle!\n");
- DEB(printf("Waking up pipe %d at %d\n",
+ printf("dummynet: OUCH! pipe should have been idle!\n");
+ DEB(printf("dummynet: waking up pipe %d at %d\n",
pipe->pipe_nr, (int)(q->F >> MY_M)); )
pipe->sched_time = curr_time ;
ready_event_wfq(pipe);
@@ -1427,7 +1428,7 @@ config_red(struct dn_flow_set *p, struct dn_flow_set * x)
x->w_q_lookup = NULL ;
}
if (red_lookup_depth == 0) {
- printf("\nnet.inet.ip.dummynet.red_lookup_depth must be > 0");
+ printf("\ndummynet: net.inet.ip.dummynet.red_lookup_depth must be > 0\n");
free(x, M_DUMMYNET);
return EINVAL;
}
@@ -1435,7 +1436,7 @@ config_red(struct dn_flow_set *p, struct dn_flow_set * x)
x->w_q_lookup = (u_int *) malloc(x->lookup_depth * sizeof(int),
M_DUMMYNET, M_NOWAIT);
if (x->w_q_lookup == NULL) {
- printf("sorry, cannot allocate red lookup table\n");
+ printf("dummynet: sorry, cannot allocate red lookup table\n");
free(x, M_DUMMYNET);
return ENOSPC;
}
@@ -1473,7 +1474,7 @@ alloc_hash(struct dn_flow_set *x, struct dn_flow_set *pfs)
x->rq = malloc((1 + x->rq_size) * sizeof(struct dn_flow_queue *),
M_DUMMYNET, M_NOWAIT | M_ZERO);
if (x->rq == NULL) {
- printf("sorry, cannot allocate queue\n");
+ printf("dummynet: sorry, cannot allocate queue\n");
return ENOSPC;
}
x->rq_elements = 0;
@@ -1532,7 +1533,7 @@ config_pipe(struct dn_pipe *p)
if (b == NULL || b->pipe_nr != p->pipe_nr) { /* new pipe */
x = malloc(sizeof(struct dn_pipe), M_DUMMYNET, M_NOWAIT | M_ZERO);
if (x == NULL) {
- printf("ip_dummynet.c: no memory for new pipe\n");
+ printf("dummynet: no memory for new pipe\n");
return ENOSPC;
}
x->pipe_nr = p->pipe_nr;
@@ -1578,7 +1579,7 @@ config_pipe(struct dn_pipe *p)
return EINVAL ;
x = malloc(sizeof(struct dn_flow_set), M_DUMMYNET, M_NOWAIT|M_ZERO);
if (x == NULL) {
- printf("ip_dummynet.c: no memory for new flow_set\n");
+ printf("dummynet: no memory for new flow_set\n");
return ENOSPC;
}
x->fs_nr = pfs->fs_nr;
@@ -1712,7 +1713,7 @@ delete_pipe(struct dn_pipe *p)
/* remove all references to this pipe from flow_sets */
for (fs = all_flow_sets; fs; fs= fs->next )
if (fs->pipe == b) {
- printf("++ ref to pipe %d from fs %d\n",
+ printf("dummynet: ++ ref to pipe %d from fs %d\n",
p->pipe_nr, fs->fs_nr);
fs->pipe = NULL ;
purge_flow_set(fs, 0);
@@ -1768,10 +1769,10 @@ dn_copy_set(struct dn_flow_set *set, char *bp)
for (i = 0 ; i <= set->rq_size ; i++)
for (q = set->rq[i] ; q ; q = q->next, qp++ ) {
if (q->hash_slot != i)
- printf("++ at %d: wrong slot (have %d, "
+ printf("dummynet: ++ at %d: wrong slot (have %d, "
"should be %d)\n", copied, q->hash_slot, i);
if (q->fs != set)
- printf("++ at %d: wrong fs ptr (have %p, should be %p)\n",
+ printf("dummynet: ++ at %d: wrong fs ptr (have %p, should be %p)\n",
i, q->fs, set);
copied++ ;
bcopy(q, qp, sizeof( *q ) );
@@ -1781,7 +1782,7 @@ dn_copy_set(struct dn_flow_set *set, char *bp)
qp->fs = NULL ;
}
if (copied != set->rq_elements)
- printf("++ wrong count, have %d should be %d\n",
+ printf("dummynet: ++ wrong count, have %d should be %d\n",
copied, set->rq_elements);
return (char *)qp ;
}
@@ -1875,7 +1876,7 @@ ip_dn_ctl(struct sockopt *sopt)
switch (sopt->sopt_name) {
default :
- printf("ip_dn_ctl -- unknown option %d", sopt->sopt_name);
+ printf("dummynet: -- unknown option %d", sopt->sopt_name);
return EINVAL ;
case IP_DUMMYNET_GET :
diff --git a/sys/netinet/ip_fw2.c b/sys/netinet/ip_fw2.c
index 433cb9e..1e2b84e 100644
--- a/sys/netinet/ip_fw2.c
+++ b/sys/netinet/ip_fw2.c
@@ -622,7 +622,7 @@ hash_packet(struct ipfw_flow_id *id)
/* remove a refcount to the parent */ \
if (q->dyn_type == O_LIMIT) \
q->parent->count--; \
- DEB(printf("-- unlink entry 0x%08x %d -> 0x%08x %d, %d left\n", \
+ DEB(printf("ipfw: unlink entry 0x%08x %d -> 0x%08x %d, %d left\n",\
(q->id.src_ip), (q->id.src_port), \
(q->id.dst_ip), (q->id.dst_port), dyn_count-1 ); ) \
if (prev != NULL) \
@@ -688,7 +688,7 @@ next_pass:
goto next;
if (FORCE && q->count != 0 ) {
/* XXX should not happen! */
- printf( "OUCH! cannot remove rule,"
+ printf("ipfw: OUCH! cannot remove rule,"
" count %d\n", q->count);
}
} else {
@@ -883,7 +883,7 @@ add_dyn_rule(struct ipfw_flow_id *id, u_int8_t dyn_type, struct ip_fw *rule)
r = malloc(sizeof *r, M_IPFW, M_NOWAIT | M_ZERO);
if (r == NULL) {
- printf ("sorry cannot allocate state\n");
+ printf ("ipfw: sorry cannot allocate state\n");
return NULL;
}
@@ -908,7 +908,7 @@ add_dyn_rule(struct ipfw_flow_id *id, u_int8_t dyn_type, struct ip_fw *rule)
r->next = ipfw_dyn_v[i];
ipfw_dyn_v[i] = r;
dyn_count++;
- DEB(printf("-- add dyn entry ty %d 0x%08x %d -> 0x%08x %d, total %d\n",
+ DEB(printf("ipfw: add dyn entry ty %d 0x%08x %d -> 0x%08x %d, total %d\n",
dyn_type,
(r->id.src_ip), (r->id.src_port),
(r->id.dst_ip), (r->id.dst_port),
@@ -937,7 +937,7 @@ lookup_dyn_parent(struct ipfw_flow_id *pkt, struct ip_fw *rule)
pkt->src_port == q->id.src_port &&
pkt->dst_port == q->id.dst_port) {
q->expire = time_second + dyn_short_lifetime;
- DEB(printf("lookup_dyn_parent found 0x%p\n",q);)
+ DEB(printf("ipfw: lookup_dyn_parent found 0x%p\n",q);)
return q;
}
}
@@ -958,7 +958,7 @@ install_state(struct ip_fw *rule, ipfw_insn_limit *cmd,
ipfw_dyn_rule *q;
- DEB(printf("-- install state type %d 0x%08x %u -> 0x%08x %u\n",
+ DEB(printf("ipfw: install state type %d 0x%08x %u -> 0x%08x %u\n",
cmd->o.opcode,
(args->f_id.src_ip), (args->f_id.src_port),
(args->f_id.dst_ip), (args->f_id.dst_port) );)
@@ -968,7 +968,7 @@ install_state(struct ip_fw *rule, ipfw_insn_limit *cmd,
if (q != NULL) { /* should never occur */
if (last_log != time_second) {
last_log = time_second;
- printf(" install_state: entry already present, done\n");
+ printf("ipfw: install_state: entry already present, done\n");
}
return 0;
}
@@ -982,7 +982,7 @@ install_state(struct ip_fw *rule, ipfw_insn_limit *cmd,
if (dyn_count >= dyn_max) {
if (last_log != time_second) {
last_log = time_second;
- printf("install_state: Too many dynamic rules\n");
+ printf("ipfw: install_state: Too many dynamic rules\n");
}
return 1; /* cannot install, notify caller */
}
@@ -998,7 +998,8 @@ install_state(struct ip_fw *rule, ipfw_insn_limit *cmd,
struct ipfw_flow_id id;
ipfw_dyn_rule *parent;
- DEB(printf("installing dyn-limit rule %d\n", cmd->conn_limit);)
+ DEB(printf("ipfw: installing dyn-limit rule %d\n",
+ cmd->conn_limit);)
id.dst_ip = id.src_ip = 0;
id.dst_port = id.src_port = 0;
@@ -1014,7 +1015,7 @@ install_state(struct ip_fw *rule, ipfw_insn_limit *cmd,
id.dst_port = args->f_id.dst_port;
parent = lookup_dyn_parent(&id, rule);
if (parent == NULL) {
- printf("add parent failed\n");
+ printf("ipfw: add parent failed\n");
return 1;
}
if (parent->count >= cmd->conn_limit) {
@@ -1035,7 +1036,7 @@ install_state(struct ip_fw *rule, ipfw_insn_limit *cmd,
}
break;
default:
- printf("unknown dynamic rule type %u\n", cmd->o.opcode);
+ printf("ipfw: unknown dynamic rule type %u\n", cmd->o.opcode);
return 1;
}
lookup_dyn_rule(&args->f_id, NULL, NULL); /* XXX just set lifetime */
@@ -1914,7 +1915,7 @@ check_body:
next_rule:; /* try next rule */
} /* end of outer for, scan rules */
- printf("+++ ipfw: ouch!, skip past end of rules, denying packet\n");
+ printf("ipfw: ouch!, skip past end of rules, denying packet\n");
return(IP_FW_PORT_DENY_FLAG);
done:
@@ -1926,7 +1927,7 @@ done:
pullup_failed:
if (fw_verbose)
- printf("pullup failed\n");
+ printf("ipfw: pullup failed\n");
return(IP_FW_PORT_DENY_FLAG);
}
@@ -2041,7 +2042,7 @@ done:
static_count++;
static_len += l;
splx(s);
- DEB(printf("++ installed rule %d, static count now %d\n",
+ DEB(printf("ipfw: installed rule %d, static count now %d\n",
rule->rulenum, static_count);)
return (0);
}
@@ -2609,7 +2610,7 @@ ipfw_ctl(struct sockopt *sopt)
break;
default:
- printf("ipfw_ctl invalid option %d\n", sopt->sopt_name);
+ printf("ipfw: ipfw_ctl invalid option %d\n", sopt->sopt_name);
error = EINVAL;
}
OpenPOWER on IntegriCloud