Commit 5f009a51 authored by Zhongyuan Zhou's avatar Zhongyuan Zhou
Browse files

network_mgmt: Modify the dguid of network control packets.

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I9VT8Q


CVE: NA

----------------------------------------------------------------------

1.The lower two bytes of the dguid field in the network
control packet are changed from add Fs to the corresponding
protocol type.

Fixes: 695becd4 ("network_mgmt: Modified OLK5.10 ub compilation missing header files")

Signed-off-by: default avatarZhongyuan Zhou <zhouzhongyuan1@huawei.com>
parent eda2c973
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -23,6 +23,11 @@
static struct workqueue_struct *ip_notify_wq;
static int initialized;

u8 ub_dguid[UBL_ALEN] = {0xFF, 0xFF, 0xFF, 0xFF,
			 0xFF, 0xFF, 0xFF, 0xFF,
			 0xFF, 0xFF, 0xFF, 0xFF,
			 0xFF, 0xFF, 0x01, 0x02};

static ssize_t good_ipv4_notify_tx_cnt_show(struct kobject *kobj,
					    struct kobj_attribute *attr,
					    char *buf)
@@ -383,7 +388,6 @@ struct sk_buff *ub_ipv4_create_ip_notify_pkt(struct net_device *ndev,
	int tlen = ndev->needed_tailroom;
	struct ip_notify_hdr *ipn_hdr_v4;
	struct sk_buff *skb;
	u8 dest_hw[UBL_ALEN];

	skb = alloc_skb(ip_notify_hdr_len() + hlen + tlen, GFP_ATOMIC);
	if (!skb)
@@ -396,12 +400,11 @@ struct sk_buff *ub_ipv4_create_ip_notify_pkt(struct net_device *ndev,
	skb->dev = ndev;
	skb->protocol = htons(ETH_P_UB);
	src_hw = ndev->dev_addr;
	memset(dest_hw, 0xff, UBL_ALEN);

	/* fill the device header for the ipv4 notify frame */
	ipn_hdr_v4->cfg = UB_NOIP_CFG_TYPE;
	ipn_hdr_v4->protocol = htons(SUB_PROTOCOL_IP_NOTIFY);
	memcpy(ipn_hdr_v4->dest_guid, dest_hw, UBL_ALEN);
	memcpy(ipn_hdr_v4->dest_guid, ub_dguid, UBL_ALEN);
	memcpy(ipn_hdr_v4->src_guid, ndev->dev_addr, UBL_ALEN);
	ipn_hdr_v4->pdu.ver = UB_PROTO_IPV4 << VER_SHIFT_4; /* IPv4 */
	ipn_hdr_v4->pdu.mask = netmask;
@@ -420,7 +423,6 @@ struct sk_buff *ub_ipv6_create_ip_notify_pkt(struct net_device *ndev,
	int tlen = ndev->needed_tailroom;
	struct ip_notify_hdr *ipn_hdr_v6;
	struct sk_buff *skb;
	u8 dest_hw[UBL_ALEN];

	skb = alloc_skb(ip_notify_hdr_len() + hlen + tlen, GFP_ATOMIC);
	if (!skb)
@@ -433,12 +435,11 @@ struct sk_buff *ub_ipv6_create_ip_notify_pkt(struct net_device *ndev,
	skb->dev = ndev;
	skb->protocol = htons(ETH_P_UB);
	src_hw = ndev->dev_addr;
	memset(dest_hw, 0xff, UBL_ALEN);

	/* fill the device header for the ip notify frame */
	ipn_hdr_v6->cfg = UB_NOIP_CFG_TYPE;
	ipn_hdr_v6->protocol = htons(SUB_PROTOCOL_IP_NOTIFY);
	memcpy(ipn_hdr_v6->dest_guid, dest_hw, UBL_ALEN);
	memcpy(ipn_hdr_v6->dest_guid, ub_dguid, UBL_ALEN);
	memcpy(ipn_hdr_v6->src_guid, ndev->dev_addr, UBL_ALEN);
	ipn_hdr_v6->pdu.ver = UB_PROTO_IPV6 << VER_SHIFT_4; /* IPv6 */
	ipn_hdr_v6->pdu.mask = netmask;