Hi, 

Inline.

> On May 25, 2022, at 2:15 AM, NUAA无痕 <nuaawan...@gmail.com> wrote:
> 
> hi, Florin Coras
> I may not have described clearly
> 
> im use vpp version 2101

Could you also try with latest vpp? We’re about to release 22.06

> 
> 1.sendto function problem
> i use LDP for c socket program with udp
> then i find if only use sendto function is error , this is client code
> 
> int main ()
> {
>     int sockfd = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
>     struct sockdaddr_in server = {0};
>     server.sin_addr.s_addr = inet_addr (192.168.1.1);
>     server.sin_port = htons (8888);
>     server.sin_family = AF_INET;
> 
>     char msg[] = "hello";
>     /* this is not same */
>     sendto (sockfd, msg, sizeof (msg), 0, (struct sockaddr *) &server  , 
> sizeof (server));
>     
>     close (sockfd);
>     return 0;
> }
> 
> this code vpp will report remote ip cannot connect error
> 
> but if use connect function,like this
> 
> int main ()
> {
>     int sockfd = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
>     struct sockdaddr_in server = {0};
>     server.sin_addr.s_addr = inet_addr (192.168.1.1);
>     server.sin_port = htons (8888);
>     server.sin_family = AF_INET;
> 
>     char msg[] = "hello";
>     /* this is not same */
>     connect (sockfd, (struct sockaddr*)&server, sizeof (server));
>     sendto (sockfd, msg, sizeof (msg), 0, (struct sockaddr *)NULL, sizeof 
> (server));
>     
>     close (sockfd);
>     return 0;
> }
> 
> ldp will work fine

Yup, that’s what I imagined you were doing. I’d expect that to work fine with 
more recent versions of vpp, but if it doesn’t do let me know. 

> 
> 2.i find vpp udp proto LDP also use mss, the code has set mss = 1500 - 20 - 8
> i think udp packet if biger than MTU , will cause ip fragment rather than 
> like tcp user mss
> (this is a good design)
> 
> but now i need send a 4K udp packet use ip fragment not use mss, because if 
> udp into mss size
> i also need reassemble(i need data), if use ip fragment and reassemble, i can 
> get data easily

UDP only sets DF in the IP header to 0 (in newer vpp versions), it does not 
implement fragmentation. You can try to increase udp's mtu to 4k and it will 
just forward the large datagram to ip. IP forwarding logic should compare the 
datagram’s size with the interface’s mtu’s and, if larger, should fragment. 

Given that udp delivery is unreliable and fragmentation/reassembly is 
expensive, I typically recommend against this.

> 
> 3."it cannot stop" is that client send "hello" once, if i use command "show 
> int", the packet will increase 1 and stop,
> but i set startup.conf udp mtu biger than 1500, i still send "hello" and 
> cannot stop, the count always increase and server also can receive it
> if mtu less than 1500 ,it is ok
> by the way, my nic that vpp manage  mtu is 9000, startup.conf udp { mtu 9000 
> } will cause this question

That might be a bug. Again, could you try a more recent vpp version and do let 
me know if the issue is still present. 

Regards, 
Florin

> 
> best  
> 
> Florin Coras <fcoras.li...@gmail.com <mailto:fcoras.li...@gmail.com>> 
> 于2022年5月22日周日 06:57写道:
> Hi, 
> 
> 
> 
> > On May 20, 2022, at 2:31 AM, NUAA无痕 <nuaawan...@gmail.com 
> > <mailto:nuaawan...@gmail.com>> wrote:
> > 
> > hi,vpp expert
> > now im use vpp hoststack for udp, i meet some problems
> > 
> > 1.udp socket must use connect function, if user sendto will cause ip 
> > address not connect error
> 
> What version of vpp are you using? Although we prefer connected udp for 
> performance reasons, sendto should work. If socket was not connected/bound, 
> vcl should connect it. What’s the exact error you’re getting and what are you 
> trying to do? 
> 
> > 
> > 2.if i use udp socket send packet biger than 1500, udp will split many 
> > packet, is some method let it dont split
> 
> What exactly are you trying to achieve? Session layer chops datagrams into 
> mss sized packets. If you’re trying to send large datagrams, up to nic mtu 
> size, then as you did lower, increase udp mtu. 
> 
> > 
> > 3.startup.conf set udp { mtu 9000 }, then use hoststack send one packet, it 
> > will always send packet and cannot stop, the mtu must less than 1500
> 
> Not sure I understand what you mean by “it cannot stop”? If by chance you’re 
> trying to force ip fragmentation, that’s not supported with udp sessions. 
> 
> Regards,
> Florin
> 
> > 
> > can u give some suggestions? than u
> > 
> > 
> > 
> 

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#21461): https://lists.fd.io/g/vpp-dev/message/21461
Mute This Topic: https://lists.fd.io/mt/91227351/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to