Commit fe83fe73 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge branch 'net-constify-dev_addr-passing-for-protocols'

Jakub Kicinski says:

====================
net: constify dev_addr passing for protocols

Commit 406f42fa ("net-next: When a bond have a massive amount
of VLANs...") introduced a rbtree for faster Ethernet address look
up. To maintain netdev->dev_addr in this tree we need to make all
the writes to it got through appropriate helpers.

netdev->dev_addr will be made const to prevent direct writes.
This set sprinkles const across variables and arguments in protocol
code which are used to hold references to netdev->dev_addr.
====================

Link: https://lore.kernel.org/r/20211012155840.4151590-1-kuba@kernel.org


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 5f3b8ace 1bfcd1cc
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -304,7 +304,7 @@ extern spinlock_t ax25_list_lock;
void ax25_cb_add(ax25_cb *);
struct sock *ax25_find_listener(ax25_address *, int, struct net_device *, int);
struct sock *ax25_get_socket(ax25_address *, ax25_address *, int);
ax25_cb *ax25_find_cb(ax25_address *, ax25_address *, ax25_digi *,
ax25_cb *ax25_find_cb(const ax25_address *, ax25_address *, ax25_digi *,
		      struct net_device *);
void ax25_send_to_raw(ax25_address *, struct sk_buff *, int);
void ax25_destroy_socket(ax25_cb *);
@@ -384,10 +384,11 @@ struct ax25_linkfail {

void ax25_linkfail_register(struct ax25_linkfail *lf);
void ax25_linkfail_release(struct ax25_linkfail *lf);
int __must_check ax25_listen_register(ax25_address *, struct net_device *);
void ax25_listen_release(ax25_address *, struct net_device *);
int __must_check ax25_listen_register(const ax25_address *,
				      struct net_device *);
void ax25_listen_release(const ax25_address *, struct net_device *);
int(*ax25_protocol_function(unsigned int))(struct sk_buff *, ax25_cb *);
int ax25_listen_mine(ax25_address *, struct net_device *);
int ax25_listen_mine(const ax25_address *, struct net_device *);
void ax25_link_failed(ax25_cb *, int);
int ax25_protocol_is_registered(unsigned int);

@@ -401,8 +402,8 @@ netdev_tx_t ax25_ip_xmit(struct sk_buff *skb);
extern const struct header_ops ax25_header_ops;

/* ax25_out.c */
ax25_cb *ax25_send_frame(struct sk_buff *, int, ax25_address *, ax25_address *,
			 ax25_digi *, struct net_device *);
ax25_cb *ax25_send_frame(struct sk_buff *, int, const ax25_address *,
			 ax25_address *, ax25_digi *, struct net_device *);
void ax25_output(ax25_cb *, int, struct sk_buff *);
void ax25_kick(ax25_cb *);
void ax25_transmit_buffer(ax25_cb *, struct sk_buff *, int);
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ struct datalink_proto {
        int     (*rcvfunc)(struct sk_buff *, struct net_device *,
                                struct packet_type *, struct net_device *);
	int     (*request)(struct datalink_proto *, struct sk_buff *,
                                        unsigned char *);
			   const unsigned char *);
	struct list_head node;
};

+1 −1
Original line number Diff line number Diff line
@@ -166,7 +166,7 @@ struct dn_skb_cb {
	int iif;
};

static inline __le16 dn_eth2dn(unsigned char *ethaddr)
static inline __le16 dn_eth2dn(const unsigned char *ethaddr)
{
	return get_unaligned((__le16 *)(ethaddr + 4));
}
+1 −1
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@ static inline void llc_sap_put(struct llc_sap *sap)
struct llc_sap *llc_sap_find(unsigned char sap_value);

int llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb,
			      unsigned char *dmac, unsigned char dsap);
			      const unsigned char *dmac, unsigned char dsap);

void llc_sap_handler(struct llc_sap *sap, struct sk_buff *skb);
void llc_conn_handler(struct llc_sap *sap, struct sk_buff *skb);
+2 −1
Original line number Diff line number Diff line
@@ -62,7 +62,8 @@
#define LLC_STATUS_CONFLICT	7 /* disconnect conn */
#define LLC_STATUS_RESET_DONE	8 /*  */

int llc_establish_connection(struct sock *sk, u8 *lmac, u8 *dmac, u8 dsap);
int llc_establish_connection(struct sock *sk, const u8 *lmac, u8 *dmac,
			     u8 dsap);
int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb);
int llc_send_disc(struct sock *sk);
#endif /* LLC_IF_H */
Loading