@@ -225,30 +225,33 @@ EXPORT_SYMBOL(inet_addr_type);
225225unsigned int inet_dev_addr_type (struct net * net , const struct net_device * dev ,
226226 __be32 addr )
227227{
228- return __inet_dev_addr_type (net , dev , addr );
228+ return __inet_dev_addr_type (net , dev , addr );
229229}
230230EXPORT_SYMBOL (inet_dev_addr_type );
231231
232232/* Given (packet source, input interface) and optional (dst, oif, tos):
233- - (main) check, that source is valid i.e. not broadcast or our local
234- address.
235- - figure out what "logical" interface this packet arrived
236- and calculate "specific destination" address.
237- - check, that packet arrived from expected physical interface.
233+ * - (main) check, that source is valid i.e. not broadcast or our local
234+ * address.
235+ * - figure out what "logical" interface this packet arrived
236+ * and calculate "specific destination" address.
237+ * - check, that packet arrived from expected physical interface.
238238 */
239-
240239int fib_validate_source (__be32 src , __be32 dst , u8 tos , int oif ,
241240 struct net_device * dev , __be32 * spec_dst ,
242241 u32 * itag , u32 mark )
243242{
244243 struct in_device * in_dev ;
245- struct flowi fl = { .nl_u = { .ip4_u =
246- { .daddr = src ,
247- .saddr = dst ,
248- .tos = tos } },
249- .mark = mark ,
250- .iif = oif };
251-
244+ struct flowi fl = {
245+ .nl_u = {
246+ .ip4_u = {
247+ .daddr = src ,
248+ .saddr = dst ,
249+ .tos = tos
250+ }
251+ },
252+ .mark = mark ,
253+ .iif = oif
254+ };
252255 struct fib_result res ;
253256 int no_addr , rpf , accept_local ;
254257 bool dev_match ;
@@ -477,9 +480,9 @@ static int rtentry_to_fib_config(struct net *net, int cmd, struct rtentry *rt,
477480}
478481
479482/*
480- * Handle IP routing ioctl calls. These are used to manipulate the routing tables
483+ * Handle IP routing ioctl calls.
484+ * These are used to manipulate the routing tables
481485 */
482-
483486int ip_rt_ioctl (struct net * net , unsigned int cmd , void __user * arg )
484487{
485488 struct fib_config cfg ;
@@ -523,7 +526,7 @@ int ip_rt_ioctl(struct net *net, unsigned int cmd, void __user *arg)
523526 return - EINVAL ;
524527}
525528
526- const struct nla_policy rtm_ipv4_policy [RTA_MAX + 1 ] = {
529+ const struct nla_policy rtm_ipv4_policy [RTA_MAX + 1 ] = {
527530 [RTA_DST ] = { .type = NLA_U32 },
528531 [RTA_SRC ] = { .type = NLA_U32 },
529532 [RTA_IIF ] = { .type = NLA_U32 },
@@ -537,7 +540,7 @@ const struct nla_policy rtm_ipv4_policy[RTA_MAX+1] = {
537540};
538541
539542static int rtm_to_fib_config (struct net * net , struct sk_buff * skb ,
540- struct nlmsghdr * nlh , struct fib_config * cfg )
543+ struct nlmsghdr * nlh , struct fib_config * cfg )
541544{
542545 struct nlattr * attr ;
543546 int err , remaining ;
@@ -692,12 +695,11 @@ static int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
692695}
693696
694697/* Prepare and feed intra-kernel routing request.
695- Really, it should be netlink message, but :-( netlink
696- can be not configured, so that we feed it directly
697- to fib engine. It is legal, because all events occur
698- only when netlink is already locked.
698+ * Really, it should be netlink message, but :-( netlink
699+ * can be not configured, so that we feed it directly
700+ * to fib engine. It is legal, because all events occur
701+ * only when netlink is already locked.
699702 */
700-
701703static void fib_magic (int cmd , int type , __be32 dst , int dst_len , struct in_ifaddr * ifa )
702704{
703705 struct net * net = dev_net (ifa -> ifa_dev -> dev );
@@ -743,9 +745,9 @@ void fib_add_ifaddr(struct in_ifaddr *ifa)
743745 struct in_ifaddr * prim = ifa ;
744746 __be32 mask = ifa -> ifa_mask ;
745747 __be32 addr = ifa -> ifa_local ;
746- __be32 prefix = ifa -> ifa_address & mask ;
748+ __be32 prefix = ifa -> ifa_address & mask ;
747749
748- if (ifa -> ifa_flags & IFA_F_SECONDARY ) {
750+ if (ifa -> ifa_flags & IFA_F_SECONDARY ) {
749751 prim = inet_ifa_byprefix (in_dev , prefix , mask );
750752 if (prim == NULL ) {
751753 printk (KERN_WARNING "fib_add_ifaddr: bug: prim == NULL\n" );
@@ -755,22 +757,24 @@ void fib_add_ifaddr(struct in_ifaddr *ifa)
755757
756758 fib_magic (RTM_NEWROUTE , RTN_LOCAL , addr , 32 , prim );
757759
758- if (!(dev -> flags & IFF_UP ))
760+ if (!(dev -> flags & IFF_UP ))
759761 return ;
760762
761763 /* Add broadcast address, if it is explicitly assigned. */
762764 if (ifa -> ifa_broadcast && ifa -> ifa_broadcast != htonl (0xFFFFFFFF ))
763765 fib_magic (RTM_NEWROUTE , RTN_BROADCAST , ifa -> ifa_broadcast , 32 , prim );
764766
765- if (!ipv4_is_zeronet (prefix ) && !(ifa -> ifa_flags & IFA_F_SECONDARY ) &&
767+ if (!ipv4_is_zeronet (prefix ) && !(ifa -> ifa_flags & IFA_F_SECONDARY ) &&
766768 (prefix != addr || ifa -> ifa_prefixlen < 32 )) {
767- fib_magic (RTM_NEWROUTE , dev -> flags & IFF_LOOPBACK ? RTN_LOCAL :
768- RTN_UNICAST , prefix , ifa -> ifa_prefixlen , prim );
769+ fib_magic (RTM_NEWROUTE ,
770+ dev -> flags & IFF_LOOPBACK ? RTN_LOCAL : RTN_UNICAST ,
771+ prefix , ifa -> ifa_prefixlen , prim );
769772
770773 /* Add network specific broadcasts, when it takes a sense */
771774 if (ifa -> ifa_prefixlen < 31 ) {
772775 fib_magic (RTM_NEWROUTE , RTN_BROADCAST , prefix , 32 , prim );
773- fib_magic (RTM_NEWROUTE , RTN_BROADCAST , prefix |~mask , 32 , prim );
776+ fib_magic (RTM_NEWROUTE , RTN_BROADCAST , prefix | ~mask ,
777+ 32 , prim );
774778 }
775779 }
776780}
@@ -781,17 +785,18 @@ static void fib_del_ifaddr(struct in_ifaddr *ifa)
781785 struct net_device * dev = in_dev -> dev ;
782786 struct in_ifaddr * ifa1 ;
783787 struct in_ifaddr * prim = ifa ;
784- __be32 brd = ifa -> ifa_address | ~ifa -> ifa_mask ;
785- __be32 any = ifa -> ifa_address & ifa -> ifa_mask ;
788+ __be32 brd = ifa -> ifa_address | ~ifa -> ifa_mask ;
789+ __be32 any = ifa -> ifa_address & ifa -> ifa_mask ;
786790#define LOCAL_OK 1
787791#define BRD_OK 2
788792#define BRD0_OK 4
789793#define BRD1_OK 8
790794 unsigned ok = 0 ;
791795
792- if (!(ifa -> ifa_flags & IFA_F_SECONDARY ))
793- fib_magic (RTM_DELROUTE , dev -> flags & IFF_LOOPBACK ? RTN_LOCAL :
794- RTN_UNICAST , any , ifa -> ifa_prefixlen , prim );
796+ if (!(ifa -> ifa_flags & IFA_F_SECONDARY ))
797+ fib_magic (RTM_DELROUTE ,
798+ dev -> flags & IFF_LOOPBACK ? RTN_LOCAL : RTN_UNICAST ,
799+ any , ifa -> ifa_prefixlen , prim );
795800 else {
796801 prim = inet_ifa_byprefix (in_dev , any , ifa -> ifa_mask );
797802 if (prim == NULL ) {
@@ -801,9 +806,9 @@ static void fib_del_ifaddr(struct in_ifaddr *ifa)
801806 }
802807
803808 /* Deletion is more complicated than add.
804- We should take care of not to delete too much :-)
805-
806- Scan address list to be sure that addresses are really gone.
809+ * We should take care of not to delete too much :-)
810+ *
811+ * Scan address list to be sure that addresses are really gone.
807812 */
808813
809814 for (ifa1 = in_dev -> ifa_list ; ifa1 ; ifa1 = ifa1 -> ifa_next ) {
@@ -817,23 +822,23 @@ static void fib_del_ifaddr(struct in_ifaddr *ifa)
817822 ok |= BRD0_OK ;
818823 }
819824
820- if (!(ok & BRD_OK ))
825+ if (!(ok & BRD_OK ))
821826 fib_magic (RTM_DELROUTE , RTN_BROADCAST , ifa -> ifa_broadcast , 32 , prim );
822- if (!(ok & BRD1_OK ))
827+ if (!(ok & BRD1_OK ))
823828 fib_magic (RTM_DELROUTE , RTN_BROADCAST , brd , 32 , prim );
824- if (!(ok & BRD0_OK ))
829+ if (!(ok & BRD0_OK ))
825830 fib_magic (RTM_DELROUTE , RTN_BROADCAST , any , 32 , prim );
826- if (!(ok & LOCAL_OK )) {
831+ if (!(ok & LOCAL_OK )) {
827832 fib_magic (RTM_DELROUTE , RTN_LOCAL , ifa -> ifa_local , 32 , prim );
828833
829834 /* Check, that this local address finally disappeared. */
830835 if (inet_addr_type (dev_net (dev ), ifa -> ifa_local ) != RTN_LOCAL ) {
831836 /* And the last, but not the least thing.
832- We must flush stray FIB entries.
833-
834- First of all, we scan fib_info list searching
835- for stray nexthop entries, then ignite fib_flush.
836- */
837+ * We must flush stray FIB entries.
838+ *
839+ * First of all, we scan fib_info list searching
840+ * for stray nexthop entries, then ignite fib_flush.
841+ */
837842 if (fib_sync_down_addr (dev_net (dev ), ifa -> ifa_local ))
838843 fib_flush (dev_net (dev ));
839844 }
@@ -844,14 +849,20 @@ static void fib_del_ifaddr(struct in_ifaddr *ifa)
844849#undef BRD1_OK
845850}
846851
847- static void nl_fib_lookup (struct fib_result_nl * frn , struct fib_table * tb )
852+ static void nl_fib_lookup (struct fib_result_nl * frn , struct fib_table * tb )
848853{
849854
850855 struct fib_result res ;
851- struct flowi fl = { .mark = frn -> fl_mark ,
852- .nl_u = { .ip4_u = { .daddr = frn -> fl_addr ,
853- .tos = frn -> fl_tos ,
854- .scope = frn -> fl_scope } } };
856+ struct flowi fl = {
857+ .mark = frn -> fl_mark ,
858+ .nl_u = {
859+ .ip4_u = {
860+ .daddr = frn -> fl_addr ,
861+ .tos = frn -> fl_tos ,
862+ .scope = frn -> fl_scope
863+ }
864+ }
865+ };
855866
856867#ifdef CONFIG_IP_MULTIPLE_TABLES
857868 res .r = NULL ;
@@ -899,8 +910,8 @@ static void nl_fib_input(struct sk_buff *skb)
899910
900911 nl_fib_lookup (frn , tb );
901912
902- pid = NETLINK_CB (skb ).pid ; /* pid of sending process */
903- NETLINK_CB (skb ).pid = 0 ; /* from kernel */
913+ pid = NETLINK_CB (skb ).pid ; /* pid of sending process */
914+ NETLINK_CB (skb ).pid = 0 ; /* from kernel */
904915 NETLINK_CB (skb ).dst_group = 0 ; /* unicast */
905916 netlink_unicast (net -> ipv4 .fibnl , skb , pid , MSG_DONTWAIT );
906917}
@@ -947,7 +958,7 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event,
947958 fib_del_ifaddr (ifa );
948959 if (ifa -> ifa_dev -> ifa_list == NULL ) {
949960 /* Last address was deleted from this interface.
950- Disable IP.
961+ * Disable IP.
951962 */
952963 fib_disable_ip (dev , 1 , 0 );
953964 } else {
0 commit comments