[GH-ISSUE #3786] UDP Packets over 1500 bytes are clipped #3010

Closed
opened 2026-05-05 13:56:45 -06:00 by gitea-mirror · 6 comments
Owner

Originally created by @half2me on GitHub (Nov 20, 2023).
Original GitHub issue: https://github.com/fatedier/frp/issues/3786

Bug Description

When proxying UDP packets over 1500 bytes, only the first 1500 bytes of the payload are received, the rest is lost.
This behaviour seems to be the same regardless of the protocol used to connect to frps. I've tried tcp, quic and kcp, they all produce the same result.

frpc Version

0.52.3

frps Version

0.52.3

System Architecture

server: linux_arm64, client: darwin_arm64

Configurations

Server:

bindPort = 7000
quicBindPort = 7000
vhostHTTPPort = 80
vhostHTTPSPort = 443

webserver.port = 8080
webserver.user = "admin"
webserver.pwd = "redacted"

auth.method = "token"
auth.token = "redacted"

Client:

[common]
server_addr = redacted
server_port = 7000
protocol = tcp # also tried kcp and quic
token = redacted

[sip-udp]
type = udp
local_ip = 127.0.0.1
local_port = 5060
remote_port = 5060

Logs

No response

Steps to reproduce

  1. Start a sample python UDP server:
import socket

bufferSize = 65535
UDPServerSocket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM)
UDPServerSocket.bind(("127.0.0.1", 5060))

while True:
    bytesAddressPair = UDPServerSocket.recvfrom(bufferSize)
    print("Got {} bytes from client".format(len(bytesAddressPair[0])))
  1. Send a large UDP packet directly (without the proxy)
import socket

# addressing information of target
IPADDR = "127.0.0.1"
PORTNUM = 5060

payload = "A" * 5000
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0)
s.connect((IPADDR, PORTNUM))
res = s.send(payload.encode())
print("Sent {0} bytes".format(res))
s.close()

The server console should show: Got 5000 bytes from client

  1. Now send the same UDP packet over frp. Start frpc, and rerun the script, but change the IPADDR from 127.0.0.1 to the public IP where frps is listening.

  2. The console of the python server now shows:
    Got 1500 bytes from client
    This is the wrong size, as its only the first part of the packet.

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @half2me on GitHub (Nov 20, 2023). Original GitHub issue: https://github.com/fatedier/frp/issues/3786 ### Bug Description When proxying UDP packets over 1500 bytes, only the first 1500 bytes of the payload are received, the rest is lost. This behaviour seems to be the same regardless of the protocol used to connect to frps. I've tried `tcp`, `quic` and `kcp`, they all produce the same result. ### frpc Version 0.52.3 ### frps Version 0.52.3 ### System Architecture server: linux_arm64, client: darwin_arm64 ### Configurations Server: ```toml bindPort = 7000 quicBindPort = 7000 vhostHTTPPort = 80 vhostHTTPSPort = 443 webserver.port = 8080 webserver.user = "admin" webserver.pwd = "redacted" auth.method = "token" auth.token = "redacted" ``` Client: ```ini [common] server_addr = redacted server_port = 7000 protocol = tcp # also tried kcp and quic token = redacted [sip-udp] type = udp local_ip = 127.0.0.1 local_port = 5060 remote_port = 5060 ``` ### Logs _No response_ ### Steps to reproduce 1. Start a sample python UDP server: ```python3 import socket bufferSize = 65535 UDPServerSocket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM) UDPServerSocket.bind(("127.0.0.1", 5060)) while True: bytesAddressPair = UDPServerSocket.recvfrom(bufferSize) print("Got {} bytes from client".format(len(bytesAddressPair[0]))) ``` 2. Send a large UDP packet directly (without the proxy) ```python import socket # addressing information of target IPADDR = "127.0.0.1" PORTNUM = 5060 payload = "A" * 5000 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0) s.connect((IPADDR, PORTNUM)) res = s.send(payload.encode()) print("Sent {0} bytes".format(res)) s.close() ``` The server console should show: `Got 5000 bytes from client` 3. Now send the same UDP packet over frp. Start frpc, and rerun the script, but change the `IPADDR` from `127.0.0.1` to the public IP where frps is listening. 4. The console of the python server now shows: `Got 1500 bytes from client` This is the wrong size, as its only the first part of the packet. ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [ ] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [X] Others
Author
Owner

@half2me commented on GitHub (Nov 20, 2023):

I've tried to send 1501 bytes of payload, and that fails the same. It seems like 1500 is the hard limit for UDP payload.

<!-- gh-comment-id:1819587000 --> @half2me commented on GitHub (Nov 20, 2023): I've tried to send `1501` bytes of payload, and that fails the same. It seems like `1500` is the hard limit for UDP payload.
Author
Owner

@half2me commented on GitHub (Nov 20, 2023):

Update, I've found the UDPPacketSize parameter that is configurable. If I increase this, it works. Maybe this could be added to the documentation?

<!-- gh-comment-id:1819608449 --> @half2me commented on GitHub (Nov 20, 2023): Update, I've found the `UDPPacketSize` parameter that is configurable. If I increase this, it works. Maybe this could be added to the documentation?
Author
Owner

@xqzr commented on GitHub (Nov 20, 2023):

Update, I've found the UDPPacketSize parameter that is configurable. If I increase this, it works. Maybe this could be added to the documentation?

https://gofrp.org/zh-cn/docs/reference/client-configures/#clientcommonconfig

<!-- gh-comment-id:1819654751 --> @xqzr commented on GitHub (Nov 20, 2023): > Update, I've found the `UDPPacketSize` parameter that is configurable. If I increase this, it works. Maybe this could be added to the documentation? https://gofrp.org/zh-cn/docs/reference/client-configures/#clientcommonconfig
Author
Owner

@fatedier commented on GitHub (Nov 21, 2023):

https://github.com/fatedier/frp#configuration-files

@half2me It is difficult for us to describe the configuration of all functions one by one. Here, it is mentioned that you can find more capabilities in the full example configuration that are not mentioned in the documentation.

<!-- gh-comment-id:1820136373 --> @fatedier commented on GitHub (Nov 21, 2023): https://github.com/fatedier/frp#configuration-files @half2me It is difficult for us to describe the configuration of all functions one by one. Here, it is mentioned that you can find more capabilities in the full example configuration that are not mentioned in the documentation.
Author
Owner

@half2me commented on GitHub (Nov 21, 2023):

@fatedier Yes, I understand. But I spent at least a few hours debugging this issue yesterday thinking it was something wrong in my application. I didn't expect frp to be modifying my data as a "default" behaviour. Is there any reason that the max udp packet size is set to 1500 instead of a higher value? What is the purpose of limiting it? Is it for memory saving?

<!-- gh-comment-id:1820584952 --> @half2me commented on GitHub (Nov 21, 2023): @fatedier Yes, I understand. But I spent at least a few hours debugging this issue yesterday thinking it was something wrong in my application. I didn't expect frp to be modifying my data as a "default" behaviour. Is there any reason that the max udp packet size is set to 1500 instead of a higher value? What is the purpose of limiting it? Is it for memory saving?
Author
Owner

@xqzr commented on GitHub (Nov 21, 2023):

@fatedier Yes, I understand. But I spent at least a few hours debugging this issue yesterday thinking it was something wrong in my application. I didn't expect frp to be modifying my data as a "default" behaviour. Is there any reason that the max udp packet size is set to 1500 instead of a higher value? What is the purpose of limiting it? Is it for memory saving?

1500 是标准的 以太网 MTU 值

<!-- gh-comment-id:1820844155 --> @xqzr commented on GitHub (Nov 21, 2023): > @fatedier Yes, I understand. But I spent at least a few hours debugging this issue yesterday thinking it was something wrong in my application. I didn't expect frp to be modifying my data as a "default" behaviour. Is there any reason that the max udp packet size is set to 1500 instead of a higher value? What is the purpose of limiting it? Is it for memory saving? 1500 是标准的 以太网 MTU 值
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#3010
No description provided.