From 65c4c6fe20c1a8bd5a4c663900cf09c19f18cf45 Mon Sep 17 00:00:00 2001 From: Jalal Mostafa Date: Thu, 11 Jul 2024 14:09:12 +0200 Subject: [PATCH] cnet-chnl: return EPROTONOSUPPORT if chnl type is unexpected Signed-off-by: Jalal Mostafa --- lib/cnet/chnl/cnet_chnl.c | 5 +++-- lib/cnet/tcp/cnet_tcp.c | 2 +- lib/usr/clib/graph/cne_graph_worker.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/cnet/chnl/cnet_chnl.c b/lib/cnet/chnl/cnet_chnl.c index 8d6c5a57..968167ee 100644 --- a/lib/cnet/chnl/cnet_chnl.c +++ b/lib/cnet/chnl/cnet_chnl.c @@ -249,7 +249,7 @@ initialize_chnl(struct chnl *ch, int typ) pcb->opt_flag |= UDP_CHKSUM_FLAG; ch->ch_proto->proto = IPPROTO_UDP; - } else { + } else if (typ == SOCK_STREAM) { rb->cb_size = rb->cb_hiwat = stk->tcp->rcv_size; sb->cb_size = sb->cb_hiwat = stk->tcp->snd_size; rb->cb_lowat = sb->cb_lowat = 1; @@ -258,7 +258,8 @@ initialize_chnl(struct chnl *ch, int typ) return __errno_set(ENOBUFS); ch->ch_proto->proto = IPPROTO_TCP; - } + } else + return __errno_set(EPROTONOSUPPORT); pcb->ch = ch; ch->ch_pcb = pcb; diff --git a/lib/cnet/tcp/cnet_tcp.c b/lib/cnet/tcp/cnet_tcp.c index 1ec2ec11..c88da7ae 100644 --- a/lib/cnet/tcp/cnet_tcp.c +++ b/lib/cnet/tcp/cnet_tcp.c @@ -3515,7 +3515,7 @@ cnet_tcp_input(struct pcb_entry *pcb, pktmbuf_t *mbuf) free_seg: free_seg(seg); - CNE_DEBUG("Leave\n\n"); + CNE_DEBUG("Leave\n"); return rc; } diff --git a/lib/usr/clib/graph/cne_graph_worker.h b/lib/usr/clib/graph/cne_graph_worker.h index 6f95f28b..e7bdbdd2 100644 --- a/lib/usr/clib/graph/cne_graph_worker.h +++ b/lib/usr/clib/graph/cne_graph_worker.h @@ -520,7 +520,7 @@ cne_node_next_stream_move(struct cne_graph *graph, struct cne_node *src, cne_edg { struct cne_node *dst = __cne_node_next_node_get(src, next); - CNE_DEBUG("Src %-16s', Dst '%-16s' next %d\n", src->name, dst->name, next); + CNE_DEBUG("Src '%-16s', Dst '%-16s' next %d\n", src->name, dst->name, next); /* Swap the pointers if dst doesn't have valid objs */ if (likely(dst->idx == 0)) {