Redistributing OSPF into BGP is probably a very bad idea.
Let OSPF do its job as your IGP.
(see disclaimer below)*
(EDIT: I’m going to post how to do the aggregation/origination in Mikrotik BGP in my next post)
BGP shouldn’t need a bunch of stuff dumped into its table for it to go sorting through and aggregating. It should just look down into the routing table, and if it sees a prefix it should advertise, then it adds that prefix into BGP. Boom. Done. If it sees no such prefix, then it does not originate the prefix anymore.
Analogy:
Imagine a bird flying over a lake looking for fish. If the bird is looking for rainbow trout, when it sees one, it will dive down and snatch it, and now there’s a rainbow trout in its talons. If there’s no rainbow trout, then it won’t dive. The bird = BGP, the lake = the routing table, the bird’s talons = bgp table… This bird just originally caught the fish. (it originated the route).
Now suppose you dragged a net through the lake and tied it up in a bundle and the bird grabs the net and flies off with the whole thing. Now it goes picking through everything in the net - frogs, snakes, fish it doesn’t want to eat, junk from the bottom - and of course a rainbow trout that it does eat. It just had to carry EVERYTHING before it could pick out what it wanted.
Back to the real world:
Your configuration sounds like a way to have the router withdraw its advertisement of the master /48 prefix if the router loses its inward-facing connectivity, yet remains connected to its eBGP peer(s). (switch failure / cable failure / interface failure / etc) That’s an excellent design, but you don’t need to redistribute OSPF to do it.
Three ways to originate the route without redistributing ospf:
Consider originating a null route to 2001:db8::/48 (use your real prefix(es) here) at your core routers in OSPF. If the border router has reachability to at least one core router, then it is “connected” to your network, and it will see that /48 route in OSPF. Configuring “network 2001:db8::/48” in the border router would then correctly cause it to originate your /48 prefix whenever it sees the route “down” in OSPF - and as the most preferred type of route: Origin IGP, and not atomic aggregate. If you have multiple border routers, they can all originate the same prefix this way.
If your network is really big and you have route reflectors, then you should just originate the prefix at the RRs and let iBGP hand it out to all of your border routers.
If your network isn’t that large, and you just want to use some specific internal prefixes to signal BGP to create the aggregate prefix when they’re reachable, then consider simply originating the more specific “flag” prefixes using network statements. If any of these network statements matches a prefix in the routing table, it will create the prefix in BGP and your aggregate statement will have its prefix to work with. You won’t need a filter - BGP will just originate the prefixes itself and then glue them together with the aggregate statement.
Basically, the goal of bgp the world over, is to forward a packet to whichever router originally held up its hand and said “I know where to go to reach this network” - When the packet reaches that router, BGP is finished, and the IGP takes over.
Redistributed routes are like the Loch Ness monster for BGP - It heard this route exists somewhere nearby, but it never was spotted by any completely believable witness.
“Best Practice Speech” disclaimer:
You know your own network better than I do, and if you have reasons for doing things the way you do, then by all means continue to do so. I simply point out best practices for those who are interested, or who may not have been aware.