inet: constify ip headers and in6_addr
[deliverable/linux.git] / net / ipv4 / udp.c
index 588f47af5faf6e0603b3b060d8f777d64505f7a4..bc0dab2593e0577a3c43cee8ca4a13d3a0e33bb6 100644 (file)
@@ -189,7 +189,7 @@ static int udp_lib_lport_inuse2(struct net *net, __u16 num,
  *  @sk:          socket struct in question
  *  @snum:        port number to look up
  *  @saddr_comp:  AF-dependent comparison of bound local IP addresses
- *  @hash2_nulladdr: AF-dependant hash value in secondary hash chains,
+ *  @hash2_nulladdr: AF-dependent hash value in secondary hash chains,
  *                   with NULL address
  */
 int udp_lib_get_port(struct sock *sk, unsigned short snum,
@@ -578,7 +578,7 @@ found:
 void __udp4_lib_err(struct sk_buff *skb, u32 info, struct udp_table *udptable)
 {
        struct inet_sock *inet;
-       struct iphdr *iph = (struct iphdr *)skb->data;
+       const struct iphdr *iph = (const struct iphdr *)skb->data;
        struct udphdr *uh = (struct udphdr *)(skb->data+(iph->ihl<<2));
        const int type = icmp_hdr(skb)->type;
        const int code = icmp_hdr(skb)->code;
@@ -909,20 +909,14 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
                rt = (struct rtable *)sk_dst_check(sk, 0);
 
        if (rt == NULL) {
-               struct flowi4 fl4 = {
-                       .flowi4_oif = ipc.oif,
-                       .flowi4_mark = sk->sk_mark,
-                       .daddr = faddr,
-                       .saddr = saddr,
-                       .flowi4_tos = tos,
-                       .flowi4_proto = sk->sk_protocol,
-                       .flowi4_flags = (inet_sk_flowi_flags(sk) |
-                                        FLOWI_FLAG_CAN_SLEEP),
-                       .fl4_sport = inet->inet_sport,
-                       .fl4_dport = dport,
-               };
+               struct flowi4 fl4;
                struct net *net = sock_net(sk);
 
+               flowi4_init_output(&fl4, ipc.oif, sk->sk_mark, tos,
+                                  RT_SCOPE_UNIVERSE, sk->sk_protocol,
+                                  inet_sk_flowi_flags(sk)|FLOWI_FLAG_CAN_SLEEP,
+                                  faddr, saddr, dport, inet->inet_sport);
+
                security_sk_classify_flow(sk, flowi4_to_flowi(&fl4));
                rt = ip_route_output_flow(net, &fl4, sk);
                if (IS_ERR(rt)) {
This page took 0.030719 seconds and 5 git commands to generate.